Description Usage Arguments Details Value See Also Examples
View source: R/01_get_polygon_boundaries.R
GetPolygonBoundaries()
returns the longitudinal and latitudinal points - coordinate pairs - that make up the boundary of the polygon.
1 | GetPolygonBoundaries(my.polygon, labels)
|
my.polygon |
Either a SpatialPolygonsDataFrame data or a sf object. See |
labels |
A character vector of polygon boundary labels used to name each matrix |
my.polygon
accepts a spatial object that contains a singular polygon (i.e. the boundary of the City of Chicago) or many polygons (i.e. a polygon for each the 77 Chicago community areas).
If my.polygon
is of length 1, a matrix of coordinate pairs will be returned; otherwise, a list of labeled matrices, with each matrix representing the coordinate pairs that make the boundary of each particular polygon in my.polygon
.
?pointdexter::city_boundary_spdf
?pointdexter::city_boundary_sf
?pointdexter::community_areas_spdf
?pointdexter::community_areas_sf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ## SpatialPolygonsDataFrame, one polygon example ## -----
# load necessary data ----
data("city_boundary_spdf")
# obtain boundaries for the City of Chicago ----
boundaries <-
GetPolygonBoundaries(my.polygon = city_boundary_spdf)
## SpatialPolygonsDataFrame, multipolygon polygon example ## -----
# load necessary data ----
data("community_areas_spdf")
# obtain boundaries for each of the 77 Chicago community areas ----
boundaries <-
GetPolygonBoundaries(my.polygon = community_areas_spdf
, labels = community_areas_spdf$community)
## sf, one polygon example ## -----
# load necessary package ----
library(sf)
# load necessary data ----
data("city_boundary_sf")
# obtain boundaries for the City of Chicago ----
boundaries <- GetPolygonBoundaries(my.polygon = city_boundary_sf)
## sf, multipolygon example ## -----
# load necessary package ----
library(sf)
# load necessary data ----
data("community_areas_sf")
# obtain boundaries for each of the 77 Chicago community areas ----
boundaries <-
GetPolygonBoundaries(my.polygon = community_areas_sf
, labels = community_areas_sf$community)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.