Read shapefile from any file or folder (trying to infer the format)
Source:R/shapefile_xyz.R
shapefile_from_any.Rd
Read shapefile from any file or folder (trying to infer the format)
Arguments
- path
path of file(s) that is/are .gdb, .zip, .shp, .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
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
shapefile_from_folder()
orshapefile_from_gdbzip()
?If .zip containing .gdb, reads with
shapefile_from_gdbzip()
If .gdb, reads with
shapefile_from_gdb()
If .shp, reads with
shapefile_from_filepaths()
which works only it is x.shp and no other .shp exists in folder and x.shx, x.dbf, x.prj are in the folder.If vector of .shp, .shx, .dbf, and .prj file names (that may include paths), reads with
shapefile_from_filepaths()
If .json or .geojson, reads with
shapefile_from_json()
- cleanit
set to FALSE if you want to skip validation and dropping invalid rows
- crs
passed to shapefile_from_filepaths() etc. and default is crs = 4269 or Geodetic CRS NAD83
- layer
optional layer name passed to
sf::st_read()
- ...
passed to
sf::st_read()
Value
a simple feature sf::sf class object using sf::st_read()