Skip to contents

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

Usage

latlon_from_shapefile(shp, include_only_latlon = TRUE)

Arguments

shp

shapefile that is class sf, as from shapefile_from_any() or sf::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.

Value

data.table with columns named lat and lon, and optionally all from shp as well, as can be used as input to ejamit(), mapfast(), etc.

See also

latlon_from_shapefile_centroids()