hydromt.DataArray.vector.from_gdf#
- static DataArray.vector.from_gdf(gdf, array_like, coords=None, dims=None, name=None, index_dim=None, keep_cols=True)#
Parse GeoDataFrame object with point geometries to DataArray with geospatial attributes and merge with
array_like
data.- Parameters:
gdf (geopandas GeoDataFrame) – Spatial coordinates. The index should match the array_like index_dim and the geometry column may only contain Point geometries.
array_like (array_like) – Values for this array. Must be an
numpy.ndarray
, ndarray like, or castable to anndarray
. If a self-described xarray or pandas object, attempts are made to use this array’s metadata to fill in other unspecified arguments. A view of the array’s data is used instead of a copy if possible.coords (sequence or dict of array_like, optional) – Coordinates (tick labels) to use for indexing along each dimension.
dims (hashable or sequence of hashable, optional) – Name(s) of the data dimension(s). Must be either a hashable (only for 1D data) or a sequence of hashables with length equal to the number of dimensions. If this argument is omitted, dimension names default to
['dim_0', ... 'dim_n']
.index_dim (str, optional) – Name of index dimension of array_like
keep_cols (bool, optional) – If True, keep gdf columns as extra coordinates in dataset
- Returns:
da – DataArray with geospatial coordinates
- Return type: