Read shapefile from any file or folder (trying to infer the format)
Source:R/shapefile_xyz.R
shapefile_from_any.RdRead shapefile from any file or folder (trying to infer the format)
Usage
shapefile_from_any(
path = NULL,
cleanit = TRUE,
crs = 4269,
layer = NULL,
inputname = NULL,
silentinteractive = FALSE,
...
)Arguments
- path
path of file(s) that is/are .gdb, .zip, .shp, .kml, .geojson, .json, etc., or folder
If .zip or folder that has more than one shapefile in it, cannot be read by this function, and must be unzipped and handled separately.
If folder, tries to read with (unexported) helper
shapefile_from_folder()Folder must contain one each of files with extensions .shp, .shx, .dbf, and .prjIf .zip containing a folder, unzips, then tries to read with (unexported) helpers
shapefile_from_folder()orshapefile_from_gdbzip()If .zip containing .gdb, reads with (unexported) helper
shapefile_from_gdbzip()If .gdb, reads with (unexported) helper
shapefile_from_gdb()If .json or .geojson, reads with (unexported) helper
shapefile_from_json()If text in geojson format, reads with (unexported) helper
shapefile_from_geojson_text()If .kml or .shp, uses
sf::st_read()If vector of .shp, .shx, .dbf, and .prj file names (that may include paths), reads with (unexported) helper
shapefile_from_filepaths()
- cleanit
set to FALSE if you want to skip validation and dropping invalid rows
- crs
passed to helper functions and default is crs = 4269 or Geodetic CRS NAD83
- layer
optional layer name passed to
sf::st_read()- inputname
vector of shiny fileInput uploaded filenames
- silentinteractive
set to TRUE to NOT prompt for a file/folder when one is not specified
- ...
passed to
sf::st_read()
Value
a simple feature sf::sf class spatial data.frame