Extract coordinates as a tibble
geo_coordinates(x, ...)
x | A geometry-like object, or one that can be
coerced to a geometry-like object using |
---|---|
... | Unused |
A tibble with one row per coordinate and columns
feature
and xy
. Vectors that include mutli geometries
will have a part
column, and vectors that include polygons
will have a ring
column.
geo_coordinates("POINT (20 17)")#> # A tibble: 1 x 4 #> feature part ring xy #> <int> <int> <int> <xy> #> 1 1 1 0 (20 17)geo_coordinates("POINT EMPTY")#> # A tibble: 0 x 4 #> # … with 4 variables: feature <int>, part <int>, ring <int>, xy <xy>geo_coordinates("LINESTRING EMPTY")#> # A tibble: 0 x 4 #> # … with 4 variables: feature <int>, part <int>, ring <int>, xy <xy>geo_coordinates("LINESTRING (30 10, 0 0)")#> # A tibble: 2 x 4 #> feature part ring xy #> <int> <int> <int> <xy> #> 1 1 1 0 (30 10) #> 2 1 1 0 (0 0)geo_coordinates("POLYGON EMPTY")#> # A tibble: 0 x 4 #> # … with 4 variables: feature <int>, part <int>, ring <int>, xy <xy>geo_coordinates("POLYGON ((30 10, 0 0, -30 10, 30 10))")#> # A tibble: 4 x 4 #> feature part ring xy #> <int> <int> <int> <xy> #> 1 1 1 1 (30 10) #> 2 1 1 1 (0 0) #> 3 1 1 1 (-30 10) #> 4 1 1 1 (30 10)geo_coordinates( "MULTIPOLYGON ( ((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)) )"ULTIPOLYGON ( ((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)) )" )#> # A tibble: 14 x 4 #> feature part ring xy #> <int> <int> <int> <xy> #> 1 1 2 1 (40 40) #> 2 1 2 1 (20 45) #> 3 1 2 1 (45 30) #> 4 1 2 1 (40 40) #> 5 1 3 2 (20 35) #> 6 1 3 2 (10 30) #> 7 1 3 2 (10 10) #> 8 1 3 2 (30 5) #> 9 1 3 2 (45 20) #> 10 1 3 2 (20 35) #> 11 1 3 3 (30 20) #> 12 1 3 3 (20 15) #> 13 1 3 3 (20 25) #> 14 1 3 3 (30 20)