geoviews.element.geo module#

class geoviews.element.geo.Contours(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Contours

Contours is a Path Element type that may contain any number of closed paths with an associated value and a coordinate reference system.

Methods

geom([union, projection])

Converts the Contours to a shapely geometry.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Contours', label='Group')

A string describing the data wrapped by the object.

geom(union=False, projection=None)[source]#

Converts the Contours to a shapely geometry.

Parameters:
unionbool, default=False

Whether to compute a union between the geometries

projectionEPSG python:str | Cartopy CRS | python:None

Whether to project the geometry to other coordinate system

Returns:
A shapely geometry
class geoviews.element.geo.Dataset(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Dataset

Coordinate system aware version of a HoloViews dataset.

Parameter Definitions


Parameters inherited from:

group = String(default='Dataset', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(0, None), constant=True, default=[Dimension('Longitude'), Dimension('Latitude')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class geoviews.element.geo.EdgePaths(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Path

EdgePaths is a simple Element representing the paths of edges connecting nodes in a graph.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='EdgePaths', label='Group')

A string describing the data wrapped by the object.

class geoviews.element.geo.Feature(data, kdims=None, vdims=None, **params)[source]#

Bases: _GeoFeature

A Feature represents a geographical feature specified as a cartopy Feature type.

Methods

clone([data, shared_data, new_type])

Clones the object, overriding data and parameters.

geoms([scale, bounds, as_element])

Returns the geometries held by the Feature.

range(dim[, data_range, dimension_range])

Return the lower and upper bounds of values along dimension.

Parameter Definitions


Parameters inherited from:

holoviews.core.dimension.LabelledData: label

holoviews.core.dimension.Dimensioned: cdims, vdims

holoviews.core.element.Element2D: extents

geoviews.element.geo._Element: kdims, crs

group = String(default='Feature', label='Group')

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, *args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters:
data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

linkbool, optional

Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.

*args

Additional arguments to pass to constructor

**overrides

New keyword arguments to pass to constructor

Returns:
Cloned object
geoms(scale=None, bounds=None, as_element=True)[source]#

Returns the geometries held by the Feature.

Parameters:
scalepython:str

Scale of the geometry to return expressed as string. Available scales depends on the Feature type.

NaturalEarthFeature:

‘10m’, ‘50m’, ‘110m’

GSHHSFeature:

‘auto’, ‘coarse’, ‘low’, ‘intermediate’, ‘high’, ‘full’

boundspython:tuple

Tuple of a bounding region to query for geometries in

as_elementbool

Whether to wrap the geometries in an element

Returns:
geometriesPolygons/Path

Polygons or Path object wrapping around returned geometries

range(dim, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Parameters:
dimension

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns:
Tuple containing the lower and upper bound
class geoviews.element.geo.FilledContours(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: QuadMesh

Contours represents a 2D array of some quantity with some associated coordinates, which may be discretized into one or more filled contours.

Parameter Definitions


Parameters inherited from:

group = String(default='FilledContours', label='Group')

A string describing the data wrapped by the object.

class geoviews.element.geo.Graph(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Graph

Attributes:
edgepaths

Returns the fixed EdgePaths or computes direct connections between supplied nodes.

Methods

edge_type

alias of EdgePaths

node_type

alias of Nodes

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Graph', label='Group')

A string describing the data wrapped by the object.

edge_type[source]#

alias of EdgePaths

property edgepaths#

Returns the fixed EdgePaths or computes direct connections between supplied nodes.

node_type[source]#

alias of Nodes

class geoviews.element.geo.HexTiles(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, HexTiles

Points represent a collection of points with an associated cartopy coordinate-reference system.

Parameter Definitions


Parameters inherited from:

group = String(default='HexTiles', label='Group')

A string describing the data wrapped by the object.

class geoviews.element.geo.Image(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Image

Image represents a 2D array of some quantity with some associated coordinates.

Methods

from_xarray

Parameter Definitions


Parameters inherited from:

holoviews.core.dimension.LabelledData: label

holoviews.core.dimension.Dimensioned: cdims

holoviews.core.element.Element2D: extents

holoviews.element.raster.Image: datatype, bounds, rtol

geoviews.element.geo._Element: kdims, crs

group = String(default='Image', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')

The dimension description of the data held in the matrix.

class geoviews.element.geo.ImageStack(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, ImageStack

ImageStack expands the capabilities of Image to by supporting multiple layers of images.

As there is many ways to represent multiple layers of images, the following options are supported:

  1. A 3D Numpy array with the shape (y, x, level)

  2. A list of 2D Numpy arrays with identical shape (y, x)

  3. A dictionary where the keys will be set as the vdims and the

    values are 2D Numpy arrays with identical shapes (y, x). If the dictionary’s keys matches the kdims of the element, they need to be 1D arrays.

  4. A tuple containing (x, y, level_0, level_1, …),

    where the level is a 2D Numpy array in the shape of (y, x).

  5. An xarray DataArray or Dataset where its coords contain the kdims.

If no kdims are supplied, x and y are used.

If no vdims are supplied, and the naming can be inferred like with a dictionary the levels will be named level_0, level_1, etc.

Parameter Definitions


Parameters inherited from:

holoviews.core.dimension.LabelledData: label

holoviews.core.dimension.Dimensioned: cdims

holoviews.core.element.Element2D: extents

holoviews.element.raster.Image: datatype, bounds, rtol

geoviews.element.geo._Element: kdims, crs

group = String(constant=True, default='ImageStack', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')

The dimension description of the data held in the matrix.

class geoviews.element.geo.Labels(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Labels

Points represent a collection of points with an associated cartopy coordinate-reference system.

Parameter Definitions


Parameters inherited from:

group = String(default='Labels', label='Group')

A string describing the data wrapped by the object.

class geoviews.element.geo.LineContours(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: QuadMesh

LineContours represents a 2D array of some quantity with some associated coordinates, which may be discretized into one or more line contours.

Parameter Definitions


Parameters inherited from:

group = String(default='LineContours', label='Group')

A string describing the data wrapped by the object.

class geoviews.element.geo.Nodes(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Nodes

Nodes is a simple Element representing Graph nodes as a set of Points. Unlike regular Points, Nodes must define a third key dimension corresponding to the node index.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Nodes', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(3, 3), default=[Dimension('Longitude'), Dimension('Latitude'), Dimension('index')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class geoviews.element.geo.Path(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Path

The Path Element contains a list of Paths stored as Nx2 numpy arrays along with a coordinate reference system.

Methods

geom([union, projection])

Converts the Path to a shapely geometry.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Path', label='Group')

A string describing the data wrapped by the object.

geom(union=False, projection=None)[source]#

Converts the Path to a shapely geometry.

Parameters:
unionbool, default=False

Whether to compute a union between the geometries

projectionEPSG python:str | Cartopy CRS | python:None

Whether to project the geometry to other coordinate system

Returns:
A shapely geometry
class geoviews.element.geo.Points(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Points

Points represent a collection of points with an associated cartopy coordinate-reference system.

Methods

geom([union, projection])

Converts the Points to a shapely geometry.

Parameter Definitions


Parameters inherited from:

group = String(default='Points', label='Group')

A string describing the data wrapped by the object.

geom(union=False, projection=None)[source]#

Converts the Points to a shapely geometry.

Parameters:
unionbool, default=False

Whether to compute a union between the geometries

projectionEPSG python:str | Cartopy CRS | python:None

Whether to project the geometry to other coordinate system

Returns:
A shapely geometry
class geoviews.element.geo.Polygons(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Polygons

Polygons is a Path Element type that may contain any number of closed paths with an associated value and a coordinate reference system.

Methods

geom([union, projection])

Converts the Path to a shapely geometry.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Polygons', label='Group')

A string describing the data wrapped by the object.

geom(union=False, projection=None)[source]#

Converts the Path to a shapely geometry.

Parameters:
unionbool, default=False

Whether to compute a union between the geometries

projectionEPSG python:str | Cartopy CRS | python:None

Whether to project the geometry to other coordinate system

Returns:
A shapely geometry
class geoviews.element.geo.QuadMesh(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, QuadMesh

QuadMesh is a Raster type to hold x- and y- bin values with associated values. The x- and y-values of the QuadMesh may be supplied either as the edges of each bin allowing uneven sampling or as the bin centers, which will be converted to evenly sampled edges.

As a secondary but less supported mode QuadMesh can contain a mesh of quadrilateral coordinates that is not laid out in a grid. The data should then be supplied as three separate 2D arrays for the x-/y-coordinates and grid values.

Methods

trimesh()

Converts a QuadMesh into a TriMesh.

from_xarray

Parameter Definitions


Parameters inherited from:

group = String(default='QuadMesh', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')

The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.

datatype = List(bounds=(0, None), default=['grid', 'xarray'], label='Datatype')

A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).

trimesh()[source]#

Converts a QuadMesh into a TriMesh.

class geoviews.element.geo.RGB(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, RGB

An RGB element is a Image containing channel data for the the red, green, blue and (optionally) the alpha channels. The values of each channel must be in the range 0.0 to 1.0.

In input array may have a shape of NxMx4 or NxMx3. In the latter case, the defined alpha dimension parameter is appended to the list of value dimensions.

Methods

from_xarray(da[, crs, apply_transform, ...])

Returns an RGB or Image element given an xarray DataArray loaded using xr.open_rasterio.

Parameter Definitions


Parameters inherited from:

holoviews.core.dimension.LabelledData: label

holoviews.core.dimension.Dimensioned: cdims

holoviews.core.element.Element2D: extents

holoviews.element.raster.Image: datatype, bounds, rtol

holoviews.element.raster.RGB: alpha_dimension

geoviews.element.geo._Element: kdims, crs

group = String(constant=True, default='RGB', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(3, 4), default=[Dimension('R'), Dimension('G'), Dimension('B')], label='Vdims')

The dimension description of the data held in the matrix. If an alpha channel is supplied, the defined alpha_dimension is automatically appended to this list.

classmethod from_xarray(da, crs=None, apply_transform=False, nan_nodata=False, **kwargs)[source]#

Returns an RGB or Image element given an xarray DataArray loaded using xr.open_rasterio.

If a crs attribute is present on the loaded data it will attempt to decode it into a cartopy projection otherwise it will default to a non-geographic HoloViews element.

Parameters:
daxarray.DataArray

DataArray to convert to element

crsCartopy CRS or EPSG python:str (optional)

Overrides CRS inferred from the data

apply_transformbool

Whether to apply affine transform if defined on the data

nan_nodatabool

If data contains nodata values convert them to NaNs

**kwargs

Keyword arguments passed to the HoloViews/GeoViews element

Returns:
element

Image/RGB/QuadMesh element

class geoviews.element.geo.Rectangles(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Rectangles

Rectangles represent a collection of axis-aligned rectangles in 2D space.

Methods

geom([union, projection])

Converts the Rectangles to a shapely geometry.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Rectangles', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(4, 4), constant=True, default=[Dimension('lon0'), Dimension('lat0'), Dimension('lon1'), Dimension('lat1')], label='Kdims')

The key dimensions of the Rectangles element represent the bottom-left (lon0, lat0) and top right (lon1, lat1) coordinates of each box.

geom(union=False, projection=None)[source]#

Converts the Rectangles to a shapely geometry.

Parameters:
unionbool, default=False

Whether to compute a union between the geometries

projectionEPSG python:str | Cartopy CRS | python:None

Whether to project the geometry to other coordinate system

Returns:
A shapely geometry
class geoviews.element.geo.Segments(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Segments

Segments represent a collection of lines in 2D space.

Methods

geom([union, projection])

Converts the Segments to a shapely geometry.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Segments', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(4, 4), constant=True, default=[Dimension('lon0'), Dimension('lat0'), Dimension('lon1'), Dimension('lat1')], label='Kdims')

The key dimensions of the Segments element represent the bottom-left (lon0, lat0) and top-right (lon1, lat1) coordinates of each segment.

geom(union=False, projection=None)[source]#

Converts the Segments to a shapely geometry.

class geoviews.element.geo.Shape(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Dataset

Shape wraps any shapely geometry type.

Methods

from_records(records[, dataset, on, value, ...])

Load data from a collection of cartopy.io.shapereader.Record objects and optionally merge it with a dataset to assign values to each polygon and form a chloropleth.

from_shapefile(shapefile, *args, **kwargs)

Loads a shapefile from disk and optionally merges it with a dataset.

geom([union, projection])

Returns the Shape as a shapely geometry

Parameter Definitions


Parameters inherited from:

group = String(default='Shape', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(0, None), default=[], label='Vdims')

Shape optionally accept a value dimension, corresponding to the supplied values.

datatype = List(bounds=(0, None), default=['geom_dictionary'], label='Datatype')

A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).

level = Number(allow_None=True, inclusive_bounds=(True, True), label='Level')

Optional level associated with the set of Contours.

classmethod from_records(records, dataset=None, on=None, value=None, index=None, drop_missing=False, element=None, **kwargs)[source]#

Load data from a collection of cartopy.io.shapereader.Record objects and optionally merge it with a dataset to assign values to each polygon and form a chloropleth. Supplying just records will return an NdOverlayof Shape Elements with a numeric index. If a dataset is supplied, a mapping between the attribute names in the records and the dimension names in the dataset must be supplied. The values assigned to each shape file can then be drawn from the dataset by supplying a value and keys the Shapes are indexed by specifying one or index dimensions.

Parameters:
recordspython:list of cartopy.io.shapereader.Record

Iterator containing Records.

datasetholoviews.Dataset

Any HoloViews Dataset type.

onpython:str or python:list or python:dict

A mapping between the attribute names in the records and the dimensions in the dataset.

valuepython:str

The value dimension in the dataset the values will be drawn from.

indexpython:str or python:list

One or more dimensions in the dataset the Shapes will be indexed by.

drop_missingbool

Whether to drop shapes which are missing from the provides dataset.

Returns:
shapesPolygons or Path object

A Polygons or Path object containing the geometries

classmethod from_shapefile(shapefile, *args, **kwargs)[source]#

Loads a shapefile from disk and optionally merges it with a dataset. See from_records for full signature.

Parameters:
recordspython:list of cartopy.io.shapereader.Record

Iterator containing Records.

datasetholoviews.Dataset

Any HoloViews Dataset type.

onpython:str or python:list or python:dict

A mapping between the attribute names in the records and the dimensions in the dataset.

valuepython:str

The value dimension in the dataset the values will be drawn from.

indexpython:str or python:list

One or more dimensions in the dataset the Shapes will be indexed by.

drop_missingbool

Whether to drop shapes which are missing from the provides dataset.

Returns:
shapesPolygons or Path object

A Polygons or Path object containing the geometries

geom(union=False, projection=None)[source]#

Returns the Shape as a shapely geometry

Parameters:
unionbool, default=False

Whether to compute a union between the geometries

projectionEPSG python:str | Cartopy CRS | python:None

Whether to project the geometry to other coordinate system

Returns:
A shapely geometry
class geoviews.element.geo.Text(x, y, text, fontsize=12, halign='center', valign='center', rotation=0, **params)[source]#

Bases: Text, _Element

An annotation containing some text at an x, y coordinate along with a coordinate reference system.

Parameter Definitions


Parameters inherited from:

holoviews.core.dimension.LabelledData: label

holoviews.core.dimension.Dimensioned: cdims, vdims

holoviews.core.element.Element2D: extents

geoviews.element.geo._Element: crs

holoviews.element.annotation.Annotation: kdims

holoviews.element.annotation.Text: group, x, y, text, fontsize, rotation, halign, valign

class geoviews.element.geo.Tiles(data, kdims=None, vdims=None, **params)[source]#

Bases: WMTS

Tiles represents an image tile source to dynamically load data from depending on the zoom level.

Parameter Definitions


Parameters inherited from:

group = String(default='Tiles', label='Group')

A string describing the data wrapped by the object.

class geoviews.element.geo.TriMesh(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: TriMesh, Graph

Attributes:
edgepaths

Returns the fixed EdgePaths or computes direct connections between supplied nodes.

Methods

edge_type

alias of EdgePaths

node_type

alias of Nodes

point_type

alias of Points

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='TriMesh', label='Group')

A string describing the data wrapped by the object.

edge_type[source]#

alias of EdgePaths

property edgepaths#

Returns the fixed EdgePaths or computes direct connections between supplied nodes.

node_type[source]#

alias of Nodes

point_type[source]#

alias of Points

class geoviews.element.geo.VectorField(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, VectorField

A VectorField contains is a collection of vectors where each vector has an associated position. The vectors should be specified by defining an angle in radians and a magnitude.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VectorField', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(1, None), default=[Dimension('Angle'), Dimension('Magnitude')], label='Vdims')

Value dimensions can be associated with a geometry.

class geoviews.element.geo.WMTS(data, kdims=None, vdims=None, **params)[source]#

Bases: _GeoFeature

The WMTS Element represents a Web Map Tile Service specified as URL containing different template variables or xyzservices.TileProvider.

These variables correspond to three different formats for specifying the spatial location and zoom level of the requested tiles:

  • Web mapping tiles sources containing {x}, {y}, and {z} variables

  • Bounding box tile sources containing {XMIN}, {XMAX}, {YMIN}, {YMAX} variables

  • Quadkey tile sources containing a {Q} variable

Tiles are defined in a pseudo-Mercator projection (EPSG:3857) defined as eastings and northings. Any data overlaid on a tile source therefore has to be defined in those coordinates or be projected.

Parameter Definitions


Parameters inherited from:

holoviews.core.dimension.LabelledData: label

holoviews.core.dimension.Dimensioned: cdims, vdims

holoviews.core.element.Element2D: extents

geoviews.element.geo._Element: kdims

group = String(default='WMTS', label='Group')

A string describing the data wrapped by the object.

crs = ClassSelector(class_=<class 'cartopy.crs.CRS'>, default=<Bound CRS: +proj=merc +a=6378137.0 +b=6378137.0 +nadgrids=@nu ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (metre) - N[north]: Northing (metre) Area of Use: - undefined Coordinate Operation: - name: unknown to WGS84 - method: NTv2 Datum: unknown using nadgrids=@null - Ellipsoid: unknown - Prime Meridian: Greenwich Source CRS: unknown , label='Crs')

Cartopy coordinate-reference-system specifying the coordinate system of the data. Inferred automatically when _Element wraps cartopy Feature object.

layer = String(default='', label='Layer')

The layer on the tile service

class geoviews.element.geo.WindBarbs(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: _Element, Selection2DExpr, Geometry

Methods

from_uv

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='WindBarbs', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(2, None), default=[Dimension('Angle'), Dimension('Magnitude')], label='Vdims')

Value dimensions can be associated with a geometry.

geoviews.element.geo.is_geographic(element, kdims=None)[source]#

Utility to determine whether the supplied element optionally a subset of its key dimensions represent a geographic coordinate system.