GetPolygonBoundaries: Obtains the boundaries of the polygon(s)

Description Usage Arguments Details Value See Also Examples

View source: R/01_get_polygon_boundaries.R

Description

GetPolygonBoundaries() returns the longitudinal and latitudinal points - coordinate pairs - that make up the boundary of the polygon.

Usage

1

Arguments

my.polygon

Either a SpatialPolygonsDataFrame data or a sf object. See ?sp::`SpatialPolygonsDataFrame-class` or help(package = "sf") for more help.

labels

A character vector of polygon boundary labels used to name each matrix

Details

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).

Value

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.

See Also

Examples

 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)

pointdexter documentation built on May 1, 2019, 10:29 p.m.