These functions provide a means to construct geometries from data
frames, possibly using
dplyr::group_by()
and dplyr::summarise()
. Collections contain zero
or more objects of type geo_point()
, geo_linestring()
, geo_polygon()
,
geo_multipoint()
, geo_multilinestring()
, and/or
geo_multipolygon()
. See wkutils::coords_point_translate_wkb()
and related
functions for high-performance methods to create these vectors.
geo_collection(feature = wksxp(), srid = NA) geo_point(xy = geo_xy(), srid = NA) geo_linestring(xy = geo_xy(), srid = NA) geo_polygon(xy = geo_xy(), ring = 1L, srid = NA) geo_multipoint(feature = wksxp(), srid = NA) geo_multilinestring(feature = wksxp(), srid = NA) geo_multipolygon(feature = wksxp(), srid = NA)
feature | A vector of one or more features. For multi geometries, this must be a collection that only contains that type (e.g., multipolygons can only be composed of polygons). |
---|---|
srid | A spatial reference identifier, coerced to
an integer by |
xy | A |
ring | A vector whose unique values separate rings. Row order matters: the first value encountered will identify the outer ring. |
A wk::wksxp()
of length 1.
# geo_point() and family all return a wk::wksxp() of length 1 c(geo_point(geo_xy(0, 1)), geo_point(geo_xy(1, 2)))#> <wk_wksxp[2]> #> [1] <POINT (0 1)> <POINT (1 2)>#> <wk_wksxp[1]> #> [1] <LINESTRING (1 2, 2 3, 3 4...>#> <wk_wksxp[1]> #> [1] <POLYGON ((0 0, 10 0, 0 10...># polygon with a hole poly_hole <- geo_polygon( geo_xy( c(35, 45, 15, 10, 35, 20, 35, 30, 20), c(10, 45, 40, 20, 10, 30, 35, 20, 30) ), ring = c(1, 1, 1, 1, 1, 2, 2, 2, 2) ) # multipoint geo_multipoint( c(geo_point(geo_xy(10, 30)), geo_point(geo_xy(12, 11))) )#> <wk_wksxp[1]> #> [1] <MULTIPOINT ((10 30), (12 11))># multilinestring geo_multilinestring( c( geo_linestring(geo_xy(0:1, 0:1)), geo_linestring(geo_xy(c(12, 30), c(11, 10))) ) )#> <wk_wksxp[1]> #> [1] <MULTILINESTRING ((0 0, 1 1), (12 11...>#> <wk_wksxp[1]> #> [1] <MULTIPOLYGON (((0 0, 10 0, 0 10...>#> <wk_wksxp[2]> #> [1] <POINT (0 1)> <GEOMETRYCOLLECTION (POINT (1 2))>