Skip to contents

Makes lat and lon columns, from a sfc_POINT class geometry field, via sf::st_coordinates()

Usage

shapefile2latlon(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.