Reputation: 63
I have a bunch of areas defined by the following data
MULTIPOLYGON (((-82.38155821054295 29.777919007756058, -82.37586672057267 29.777692426264537,...))
I'm wondering if there is any simple way to transform these strings into a format that is usable by either the {sf} package or if there is a recipe that can pivot the pair within the string to respective lat/lon columns.
Thanks in advance.
Upvotes: 1
Views: 54
Reputation: 9087
Your data is already in a format (WKT) that can be read by sf
.
df <- read.csv("https://data.cityofgainesville.org/api/views/w6hi-8tsw/rows.csv?accessType=DOWNLOAD")
sf::st_as_sfc(df$the_geom)
#> Geometry set for 24 features
#> geometry type: MULTIPOLYGON
#> dimension: XY
#> bbox: xmin: -82.42229 ymin: 29.5929 xmax: -82.22238 ymax: 29.77834
#> CRS: NA
#> First 5 geometries:
#> MULTIPOLYGON (((-82.38156 29.77792, -82.37587 2...
#> MULTIPOLYGON (((-82.34404 29.7036, -82.34362 29...
#> MULTIPOLYGON (((-82.40023 29.67428, -82.40003 2...
#> MULTIPOLYGON (((-82.33932 29.64188, -82.33933 2...
#> MULTIPOLYGON (((-82.33221 29.61823, -82.33225 2...
Upvotes: 3