Geocomputation with R 的前七章是关于R运算地理数据的最基本概念、方法和示例。这里将这些基本章节中使用到的程辑包以及函数总结如下。
Chapter 2
Packages
-
sf -
raster -
spData -
spDataLarge
Functions
-
names(),summary(),class() -
st_as_sf(),st_sfc(),st_sf() -
st_point() -
st_multipoint() -
st_linestring() -
st_polygon() -
st_multilinestring() -
st_multipolygon() -
st_geometrycollection() -
rbind,cbind,list -
st_geometry_type() -
st_crs() -
st_set_crs() -
st_area() -
set_units() -
system.file() -
raster() -
brick() -
stack() -
crs() -
projection() -
res() -
nlayers() -
rgdal::make_EPSG()
Easy to be confusing
-
world["lifeExp"],输出的是列lifeExp以及geom(地理数据)。 -
world[, c("name_long", "lifeExp")],输出的是name_long和lifeExp两列以及geom(地理数据)。 -
world[["lifeExp"]],输出的仅仅是列lifeExp的值,没有地理数据。 -
world[1:2, 1:3],这时[]中,分别是1-2行、1-3列的非空间数据,以及geom数据。
Chapter 3
Packages
-
sf -
raster -
dplyr -
stringr -
spData
Functions
-
methods(),dim(),nrow(),ncol() -
subset() -
select() -
filter() -
pull() -
slice() -
filter() -
names() -
st_geometry() -
st_drop_geometry() -
aggregate() -
group_by(),summarize() -
top_n(),arrange(),desc() -
left_join() -
inner_join() -
rename(),set_names() -
setdiff() -
str_subset(),grepl() -
mutate() -
transmute() -
level() -
factorValues() -
cellStats() -
hist()
Chapter 4
Packages
-
sf -
raster -
dplyr -
spData
Functions
-
filter() -
[ -
st_intersects() -
st_disjoint() -
st_within() -
st_touches() -
st_is_within_distance() -
st_cast() -
st_bbox() -
st_join() -
st_interpolate_aw(), Areal-weighted interpolation of polygon data -
st_distance() -
st_centroid() -
length(),lengths() -
tibble() -
cellFromXY() -
extract() -
values() -
mask() -
overlay() -
reclassify() -
focal() -
zonal() -
merge() -
getData()
Chapter 5
Packages
-
sf -
raster -
dplyr -
spData -
spDataLarge
Functions
-
st_simplify() -
ms_simplify() -
st_transform() -
st_point_on_surface() -
st_buffer() -
st_set_geometry() -
st_intersection() -
st_sample() -
st_union() -
st_length() -
identical() -
text() -
as.numeric() -
all.equal() -
extand() -
origin() -
disaggregate() -
aggregate() -
resample() -
crop() -
extract() -
rasterize() -
rasterToPoints() -
rasterToContour() -
hilShade() -
terrain(),terrain.colors() -
contour() -
rasterToPolygons() -
st_combine() -
st_convex_hull() -
purrr::map_dfr(),xyFromCell(),distGeo(), cumsum() -
tidyr::gather(),tally(),tidyr::spread()
Chapter 6
Packages
-
sf -
raster -
dplyr -
spData -
spDataLarge
Functions
-
st_is_longlat() -
lonlat2UTM() -
st_coordinates() -
st_transform() -
projectRaster() -
lwgeom::st_transform_groj() -
unique()
Chapter 7
Packages
-
sf -
raster -
dplyr -
spData
Functions
-
download.file() -
st_read() -
read_sf() -
ne_countries() -
opq(),add_osm_feature(),osmdata_sf() -
httr::GET() -
httr::modify_url() -
httr::content() -
httr::write_disk() -
xml2::read_xml() -
tempfile() -
st_drivers() -
st_layers() -
st_write() -
write_sf() -
writeRaster() -
mapview::mapview(),mapview::mapshot()