holoviews.core.data.spatialpandas module#
- class holoviews.core.data.spatialpandas.SpatialPandasInterface(*, name)[source]#
Bases:
MultiInterface
Parameter Definitions
- classmethod applies(obj)[source]#
Indicates whether the interface is designed specifically to handle the supplied object’s type. By default simply checks if the object is one of the types declared on the class, however if the type is expensive to import at load time the method may be overridden.
- classmethod as_dframe(dataset)[source]#
Returns the data of a Dataset as a dataframe avoiding copying if it already a dataframe type.
- base_interface[source]#
alias of
PandasInterface
- classmethod isscalar(dataset, dim, per_geom=False)[source]#
Tests if dimension is scalar in each subpath.
- classmethod length(dataset)[source]#
Returns the length of the multi-tabular dataset making it appear like a single array of concatenated subpaths separated by NaN values.
- classmethod select(dataset, selection_mask=None, **selection)[source]#
Applies selectiong on all the subpaths.
- classmethod select_mask(dataset, selection)[source]#
Given a Dataset object and a dictionary with dimension keys and selection keys (i.e. tuple ranges, slices, sets, lists, or literals) return a boolean mask over the rows in the Dataset object that have been selected.
- classmethod shape(dataset)[source]#
Returns the shape of all subpaths, making it appear like a single array of concatenated subpaths separated by NaN values.
- holoviews.core.data.spatialpandas.from_multi(eltype, data, kdims, vdims)[source]#
Converts list formats into spatialpandas.GeoDataFrame.
Parameters#
- eltype
Element type to convert
- data
The original data
- kdims
The declared key dimensions
- vdims
The declared value dimensions
Returns#
A GeoDataFrame containing in the list based format.
- holoviews.core.data.spatialpandas.from_shapely(data)[source]#
Converts shapely based data formats to spatialpandas.GeoDataFrame.
Parameters#
- data
A list of shapely objects or dictionaries containing shapely objects
Returns#
A GeoDataFrame containing the shapely geometry data.
- holoviews.core.data.spatialpandas.geom_array_to_array(geom_array, index, expand=False, geom_type=None)[source]#
Converts spatialpandas extension arrays to a flattened array.
Parameters#
geom : spatialpandas geometry index
The column index to return
Returns#
Flattened array
- holoviews.core.data.spatialpandas.geom_to_array(geom, index=None, multi=False, geom_type=None)[source]#
Converts spatialpandas geometry to an array.
Parameters#
geom : spatialpandas geometry index
The column index to return
- multi
Whether to concatenate multiple arrays or not
Returns#
Array or list of arrays.
- holoviews.core.data.spatialpandas.geom_to_holes(geom)[source]#
Extracts holes from spatialpandas Polygon geometries.
Parameters#
geom : spatialpandas geometry
Returns#
List of arrays representing holes
- holoviews.core.data.spatialpandas.get_geom_type(gdf, col)[source]#
Return the HoloViews geometry type string for the geometry column.
Parameters#
- gdf
The GeoDataFrame to get the geometry from
- col
The geometry column
Returns#
A string representing the type of geometry
- holoviews.core.data.spatialpandas.get_value_array(data, dimension, expanded, keep_index, geom_col, is_points, geom_length=<function geom_length>)[source]#
Returns an array of values from a GeoDataFrame.
Parameters#
data : GeoDataFrame dimension
The dimension to get the values from
- expanded
Whether to expand the value array
- keep_index
Whether to return a Series
- geom_col
The column in the data that contains the geometries
- is_points
Whether the geometries are points
- geom_length
The function used to compute the length of each geometry
Returns#
An array containing the values along a dimension
- holoviews.core.data.spatialpandas.to_geom_dict(eltype, data, kdims, vdims, interface=None)[source]#
Converts data from any list format to a dictionary based format.
Parameters#
- eltype
Element type to convert
- data
The original data
- kdims
The declared key dimensions
- vdims
The declared value dimensions
Returns#
A list of dictionaries containing geometry coordinates and values.
- holoviews.core.data.spatialpandas.to_spatialpandas(data, xdim, ydim, columns=None, geom='point')[source]#
Converts list of dictionary format geometries to spatialpandas line geometries.
Parameters#
data : List of dictionaries representing individual geometries xdim
Name of x-coordinates column
- ydim
Name of y-coordinates column
columns : List of columns to add geom
The type of geometry
Returns#
A spatialpandas.GeoDataFrame version of the data