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, excel or xy file and parse to
geopandas.GeoDataFrame()
.CSV 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 file
driver ({'csv', 'xls', 'xy', 'vector'}, optional) – driver used to read the file:
geopandas.open_file()
for gdal vector files,hydromt.io.open_vector_from_table()
for csv, xls(x) and xy files. By default None, and infered from file extention.crs (str, pyproj.CRS, or dict) – Source coordinate reference system, ignored for files with a native crs.
dst_crs (str, pyproj.CRS, or dict) – Destination coordinate reference system.
bbox (array of float, default None) – Filter features by given bounding box described by [xmin, ymin, xmax, ymax] Cannot be used with mask.
geom (GeoDataFrame or GeoSeries | shapely Geometry, default None) – 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 csv or xls tables
y_dim (str) – Name of x, y-coordinate columns, only applicable for csv or xls tables
assert_gtype ({Point, LineString, Polygon}, optional) – If given, assert geometry type
mode ({'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
- Returns:
gdf – Parsed geometry file
- Return type: