Convert shapefile (class sf) to data.table of lat and lon columns Makes lat and lon columns, from a sfc_POINT class geometry field, or finds centroids of POLYGONS
Source:R/shapefile_xyz.R
latlon_from_shapefile.Rd
Convert shapefile (class sf) to data.table of lat and lon columns Makes lat and lon columns, from a sfc_POINT class geometry field, or finds centroids of POLYGONS
Arguments
- shp
shapefile that is class sf, as from
shapefile_from_any()
orsf::st_read()
, with geometry column that has points so is class sfc_POINT- include_only_latlon
set to FALSE to have function return lat lon columns plus all of columns in shp. If TRUE, just returns lat lon columns.