here.inspector.base module
here.inspector.base module
This module defines base class for HERE inspector package.
class here.inspector.base.Inspector
Bases: ABC
An interactive map data inspector that can be rendered in Jupyter.
Use add_features and/or add_tiles functions to add content. Configure, if needed, via the set_* functions. Call show() to render the result.
abstract add_features(features: GeoSeries | GeoDataFrame | BaseGeometry | Iterable[BaseGeometry] | Iterable[Tuple[BaseGeometry, Dict[str, Any]]] | Dict[str, Any] | Iterable[Dict[str, Any]], name=None, style: Color | Dict | None = None) Inspector
Add to the inspector a collection of map features (attributed geometries) as new layer.
The features layer can be named and styled.
Parameters:
-
features –
the attributed geometries to render. Supported types: -
gpd.GeoSeries, unattributed geometries -gpd.GeoDataFrame, attributes geometries -Iterableof BaseGeometry, it can be any containerbut also a
Generatorof unattributed geometries-
Iterableof pair ofBaseGeometryandDict, it can be any container
but also aGeneratorof geometries paired with attributes -
Dicta parsed GeoJSONFeatureCollectionorFeature -
Iterableof parsed GeoJSON Feature, it can be any container
but also aGeneratorof parsed GeoJSON features
-
-
name – an optional name to assign to the layer
-
style – an optional style for the features. If not present, a default one is picked. It can be a generic inspector style, as defined in
here.inspector.styles, or directly a style dictionary, compatible with the inspector implementation.
Returns:
self, for further chaining # noqa
abstract add_tiles(tiles: Series | Iterable[int] | None = None, name=None, style: Color | Dict | None = None) Inspector
Add to the inspector a tiling grid as new layer.
The grid can be a complete grid or contain only some tiles. The grid layer can be named and styled.
Parameters:
-
tiles – the identifier of the tiles to render. Supported types: -
pd.Seriesof tile identifiers -Iterableof tile identifiers, it can be any container but also aGenerator-Noneadd the complete grid of all the tiles defined by the tiling scheme -
name – an optional name to assign to the layer
-
style – an optional style for the tiling grid. If not present, a default one is picked. It can be a generic inspector style, as defined in
here.inspector.styles, or directly a style dictionary, compatible with the inspector implementation.
Returns:
self, for further chaining # noqa
abstract backend()
Expose the main abstraction of the rendering backend, to give advanced users the possibility to further customize the inspector.
The type of the returned object depends on the rendering backend:
ipyleaflet.Mapfor the _ipyleaflet_ backend.
The component is configured and loaded with data passed to the inspector so far. After further configuration of the rendering backend, users should call the show() function of the inspector to render the result. Alternatively, users can use the native API of the abstraction returned.
Returns:
main abstraction of the rendering backend # noqa
Raises:
ValueError – in case the backend can’t be configured with the data provided # noqa
abstract set_basemap(basemap: dict | TileProvider | None = None) Inspector
Set a custom basemap to use as a background.
This overrides the default base map of the theme, if any is defined. Setting it to None restores the default base map.
Parameters:
basemap – Either a dictionary or an object of class:xyzservices.lib.TileProvider.
Returns:
``self`, for further chaining # noqa
abstract set_center(center: Point) Inspector
Configure the location to show in the inspector when opened.
If not set, an optimal starting location is calculated from the geodata and tiling grids.
Parameters:
center – the center point of the map
Returns:
self, for further chaining # noqa
abstract set_colors(colors: List[Color]) Inspector
Set the list of colors the inspector cycles through to render content when no color or style is specified.
The default color list can be overridden in here.inspector.options.default_colors.
Parameters:
colors – a non-empty list of colors
Returns:
self, for further chaining # noqa
Raises:
ValueError – in case the colors are not valid # noqa
abstract set_theme(theme: Theme) Inspector
Set the inspector theme.
This determines the background map, if any, and colors. The default theme can be overridden in here.inspector.options.default_theme.
Parameters:
theme – one of the predefined inspector themes
Returns:
self, for further chaining # noqa
abstract set_zoom(zoom: int) Inspector
Configure the starting zoom level of the inspector.
If not set, an optimal starting zoom level is calculated from the geodata and tiling grids.
Parameters:
zoom – the zoom level, from 0 to 31
Returns:
self, for further chaining # noqa
abstract show()
Show the inspector in a Jupyter notebook.
Returns:
an object renderable by Jupyter # noqa