| read_geo | R Documentation |
Chooses the reader from tools::file_ext(path) (case-insensitive):
.zip — read_sf_zip()
.kmz — read_kmz()
.kml — internal KML reader (same tibble layout; fpath is the .kml file)
.gdb — read_gdb()
anything else GDAL/sf can open on path — one row per layer from
sf::st_layers() (e.g. .shp, .gpkg, .geojson)
read_geo(path, layer = NULL, quiet = TRUE, ...)
path |
Path to a spatial file or a |
layer |
Passed to multi-layer GDAL readers. Ignored for |
quiet |
Passed to |
... |
Additional arguments passed to |
A tibble as described in read_gdb().
d <- system.file("extdata", package = "misc")
f <- function(...) file.path(d, ...)
if (file.exists(f("misc_example.zip"))) read_geo(f("misc_example.zip"))
if (file.exists(f("misc_example.kmz"))) read_geo(f("misc_example.kmz"))
if (file.exists(f("misc_example.kml"))) read_geo(f("misc_example.kml"))
if (file.exists(f("misc_example.gpkg"))) read_geo(f("misc_example.gpkg"))
if (file.exists(f("misc_example.geojson"))) read_geo(f("misc_example.geojson"))
if (file.exists(f("misc_example.shp"))) read_geo(f("misc_example.shp"))
if (dir.exists(f("misc_example.gdb"))) read_geo(f("misc_example.gdb"), layer = "OGRGeoJSON")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.