Introduction to Spatial Data
We have been mapping points, but there are several spatial features that can be mapped, including polygons. In R, polygons are often stored in a SpatialPolygonsDataFrame that holds the polygon, coordinate information, and a data frame with one row per polygon.
A SpatialPolygonsDataFrame called shp
that contains the zip code boundaries for North Carolina has been loaded for you. shp
has five slots that store various types of information:
- data: data associated with each polygon
- polygons: coordinates to plot polygons
- plotOrder: order in which polygons are plotted
- bbox: bounding box for geographic data (i.e., a rectangle)
- proj4string: coordinate reference system
Let's take a closer look inside the shp
object.
Diese Übung ist Teil des Kurses
Interactive Maps with leaflet in R
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Print a summary of the `shp` data
___(shp)