alathrop
5/24/2018 - 8:40 PM

sf basics

basics of the sf package for R (geospatial)


# sf package vignette #1
# <https://r-spatial.github.io/sf/articles/sf1.html>

library(sf)
## Linking to GEOS 3.5.0, GDAL 2.2.2, proj.4 4.8.0
nc <- st_read(system.file("shape/nc.shp", package="sf"))
## Reading layer `nc' from data source `/tmp/RtmpZSYZI1/temp_libpath6d6f7a00fadb/sf/shape/nc.shp' using driver `ESRI Shapefile'
## Simple feature collection with 100 features and 14 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
## epsg (SRID):    4267
## proj4string:    +proj=longlat +datum=NAD27 +no_defs

class(nc)
## [1] "sf"         "data.frame"

attr(nc, "sf_column")
## [1] "geometry"

print(nc[9:15], n = 3)