Hi,
I have a dataframe that is intersected from two fortified shapefiles. The first row of the new dataframe is like this below (can't input more due to word limits). I have two questions:
- How can I convert the geometry column to separate columns with longitude and latitude so that I can map the points?
- Is there a way to combine the geometry column by another variable (id)? There are two values in id (40 and 41). What I want to do is to map the polygon by the id variable.
Thank you for your attention and help!
structure(list(id = "41", geometry = structure(list(structure(list(
structure(c(-71.4040535189999, -71.4040835179999, -71.4041215189999,
-71.404510519, -71.404560518, -71.404602519, -71.404602519,
-71.404716518, -71.4038335179999, -71.4030385189999, -71.4020585179999,
-71.401825518, -71.4016515179999, -71.400536517, -71.400500517,
-71.400452517, -71.4003685179999, -71.400315517, -71.400269517,
-71.4001465169999, -71.401008518, -71.4013135169999, -71.4015355179999,
-71.401554517, -71.4018105179999, -71.402083518, -71.4026645179999,
-71.4027105179999, -71.403580518, -71.4040535189999, 41.8245935400001,
41.8248955400001, 41.82528354, 41.82526154, 41.82571854,
41.82611554, 41.826157541, 41.8269165400001, 41.82699454,
41.82706154, 41.8271415410001, 41.8271605410001, 41.827177541,
41.827290541, 41.826901541, 41.8263745400001, 41.8255435410001,
41.8251205400001, 41.82476854, 41.8239185400001, 41.82381854,
41.8237835400001, 41.82375854, 41.82375754, 41.82375454,
41.82375454, 41.82375454, 41.82460854, 41.8246045400001,
41.8245935400001), .Dim = c(30L, 2L))), class = c("XY", "POLYGON",
"sfg"))), class = c("sfc_POLYGON", "sfc"), precision = 0, bbox = structure(c(xmin = -71.404716518,
ymin = 41.82375454, xmax = -71.4001465169999, ymax = 41.827290541
), class = "bbox"), crs = structure(list(input = "EPSG:4326",
wkt = "GEOGCS[\"WGS 84\",\n DATUM[\"WGS_1984\",\n SPHEROID[\"WGS 84\",6378137,298.257223563,\n AUTHORITY[\"EPSG\",\"7030\"]],\n AUTHORITY[\"EPSG\",\"6326\"]],\n PRIMEM[\"Greenwich\",0,\n AUTHORITY[\"EPSG\",\"8901\"]],\n UNIT[\"degree\",0.0174532925199433,\n AUTHORITY[\"EPSG\",\"9122\"]],\n AUTHORITY[\"EPSG\",\"4326\"]]"), class = "crs"), n_empty = 0L)), row.names = c(NA,
-1L), sf_column = "geometry", agr = structure(c(OBJECTID = NA_integer_,
NAME = NA_integer_, COUNTY = NA_integer_, OSP = NA_integer_,
TWNCODE = NA_integer_, LAND = NA_integer_, Shape__Are = NA_integer_,
Shape__Len = NA_integer_, OBJECTID.1 = NA_integer_, ZCTA5CE10 = NA_integer_,
Shape__Are.1 = NA_integer_, Shape__Len.1 = NA_integer_, zip = NA_integer_
), class = "factor", .Label = c("constant", "aggregate", "identity"
)), class = c("tbl_df", "tbl", "data.frame"))