read#
- read(path: Union[str, CloudPath, Path], crs: Optional[Any] = None, archive_regex: Optional[str] = None, **kwargs) GeoDataFrame [source]#
Read any vector:
if KML: sets correctly the drivers and open layered KML (you may need
ogr2ogr
to make it work !)- if archive (only zip or tar), use a regex to look for the vector inside the archive.
You can use this site to build your regex.
if GML: manages the empty errors
>>> # Usual >>> path = 'D:/path/to/vector.geojson' >>> vectors.read(path, crs=WGS84) Name ... geometry 0 Sentinel-1 Image Overlay ... POLYGON ((0.85336 42.24660, -2.32032 42.65493,... >>> # Archive >>> arch_path = 'D:/path/to/zip.zip' >>> vectors.read(arch_path, archive_regex=r".*map-overlay.kml") Name ... geometry 0 Sentinel-1 Image Overlay ... POLYGON ((0.85336 42.24660, -2.32032 42.65493,...
- Parameters:
path (AnyPathStrType) – Path to vector to read. In case of archive, path to the archive.
crs – Wanted CRS of the vector. If None, using naive or origin CRS.
archive_regex (str) – [Archive only] Regex for the wanted vector inside the archive
**kwargs – Additional arguments used in gpd.read_file
- Returns:
Read vector as a GeoDataFrame
- Return type:
gpd.GeoDataFrame