Geometry to lat lon

I have a shapefile named countyonevariable

I want to have lat and lon as column for the shapefile. Cause I want to label based on COUNTYFP. However, the code require lat lon for the shapefile. I am trying to convert this geometry column to lat lon. How can this be done?

Hi I assume that you want to extract the coordinates from the object.

countryonevariable %>%
  dplyr::mutate(lon = sf::st_coordinates(.)[,2],
                lat = sf::st_coordinates(.)[,1])
1 Like

Not clear what you are trying to do. You have lat-longs as your geometry already. Are you getting an error when you try to plot the data? Tell us more.
A reproducible example would help as well.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.