hydromt.io.open_vector#
- hydromt.io.open_vector(fn, driver=None, crs=None, dst_crs=None, bbox=None, geom=None, assert_gtype=None, predicate='intersects', mode='r', logger=<Logger hydromt.io (WARNING)>, **kwargs)[source]#
Open fiona-compatible geometry, csv, parquet, excel or xy file and parse it.
Construct a
geopandas.GeoDataFrame()CSV, parquet, or XLS file are converted to point geometries based on default columns names for the x- and y-coordinates, or if given, the x_dim and y_dim arguments.- Parameters:
fn (
str) – path to geometry filedriver (
{'csv', 'xls', 'xy', 'vector', 'parquet'}, optional) – driver used to read the file:geopandas.open_file()for gdal vector files,hydromt.io.open_vector_from_table()for csv, parquet, xls(x) and xy files. By default None, and infered from file extention.crs (
str, pyproj.CRS, ordict) – Source coordinate reference system, ignored for files with a native crs.dst_crs (
str, pyproj.CRS, ordict) – Destination coordinate reference system.bbox (
arrayoffloat, defaultNone) – Filter features by given bounding box described by [xmin, ymin, xmax, ymax] Cannot be used with mask.geom (
GeoDataFrameorGeoSeries | shapely Geometry, defaultNone) – Filter for features that intersect with the mask. CRS mis-matches are resolved if given a GeoSeries or GeoDataFrame. Cannot be used with bbox.predicate (
{'intersects', 'within', 'contains', 'overlaps', 'crosses', 'touches'},) – optional. If predicate is provided, the GeoDataFrame is filtered by testing the predicate function against each item. Requires bbox or mask. By default ‘intersects’x_dim (
str) – Name of x, y-coordinate columns, only applicable for parquet, csv or xls tablesy_dim (
str) – Name of x, y-coordinate columns, only applicable for parquet, csv or xls tablesassert_gtype (
{Point, LineString, Polygon}, optional) – If given, assert geometry typemode (
{'r', 'a', 'w'}) – file opening mode (fiona files only), by default ‘r’**kwargs – Keyword args to be passed to the driver method when opening the file
logger (
logger object, optional) – The logger object used for logging messages. If not provided, the default logger will be used.
- Returns:
gdf – Parsed geometry file
- Return type: