Uses zip::zip_list() to find .shp members, then reads each with sf::read_sf() on a /vsizip/... path. Multiple shapefiles become one row each (list-column data), so differing CRS are not merged.

read_sf_zip(path, quiet = TRUE, by_bbox = NULL, ...)

Arguments

path

Path to a .zip file.

quiet

Passed to sf::read_sf().

by_bbox

If NULL (default), every feature is read. Otherwise an sf, sfc, bbox or named numeric vector (xmin, ymin, xmax, ymax) whose bounding box limits the features read: only features that intersect it are returned, filtered by GDAL at read time through the wkt_filter argument of sf::st_read(). The bounding box is reprojected to each layer's CRS; if it has no CRS, its coordinates are assumed to be in the layer's CRS. If the layer has no CRS it can be reprojected to (no .prj, or an undefined LOCAL_CS), the coordinates are used as-is with a warning. Features with empty geometry are dropped. Layers without a geometry column (e.g. a shapefile made of a .dbf only, or an attribute table in a GeoPackage) cannot be filtered: they are read in full with a warning. When set, nrows_aka_features reports the number of features read, not the layer total. Cannot be combined with wkt_filter in ....

...

Additional arguments passed to sf::read_sf().

Value

A tibble with fpath (the /vsizip/... dsn), file_type, metadata from sf::st_layers(), and data (list-column of sf). See read_gdb().

See also

Examples

# \donttest{
z <- system.file("extdata", "misc_example.zip", package = "misc")
if (nzchar(z) && file.exists(z)) read_sf_zip(z)
# }