API reference#
- class jupytergis.GISDocument(path=None, latitude=None, longitude=None, zoom=None, extent=None, bearing=None, pitch=None, projection=None)#
Create a new GISDocument object.
- Parameters:
path (
str|Path|None) – the path to the file that you would like to open. If not provided, a new ephemeral widget will be created.
Collaborative client state from the front end is mirrored into
ypywidgetsAwarenesson the kernel. Subscribe withon_awareness_change(callback)(returns a subscription id; useunobserve_awareness(id)to remove). The current snapshot is available asawareness.stateson the underlyingpycrdt.Awarenessvia the inheritedawarenessproperty.- async add_data_array_layer(data_array, *, name='Data Array layer', colormap_name='viridis', colormap_range=None, opacity=1, tile_dim_scale=1, algorithm=None, **params)#
Add an Xarray DataArray as a layer on the map.
- Parameters:
data_array (
DataArray) – An Xarray DataArray to display on the mapname (
str) – The layer’s namecolormap_name (
str) – Ario-tiler-supported colormap name. See the rio-tiler docs for details.colormap_range (
tuple[float,float] |None) – The range of data values(min, max)to be colormappedopacity (
float) – The opacity, between 0 and 1tile_dim_scale (
int) – Tile dimension scale. Default1corresponds to 256*256px tilesalgorithm (
BaseAlgorithm|None) – A TiTiler algorithm class. See the TiTiler algorithm docs for details.
- add_geojson_layer(path=None, data=None, name=None, opacity=1, symbology=None)#
Add a GeoJSON Layer to the document.
- Parameters:
name (
str|None) – The name that will be used for the object in the document.path (
str|Path|None) – The path to the JSON file or URL to embed into the jGIS file.data (
dict|None) – The raw GeoJSON data to embed into the jGIS file.opacity (
float) – The opacity, between 0 and 1.symbology (
GrammarSymbology|Layer|list[Mapping] |list[GrammarSymbology|Layer|list[Mapping] |tuple[Mapping,...]] |BaseModel|dict[str,Any] |None) – The symbology configuration to persist with the layer.
- add_geopackage_raster_layer(path, table_names=None, name=None, attribution='', opacity=1)#
Add a GeoPackage Raster Layer to the document.
- add_geopackage_vector_layer(path, table_names=None, name=None, type='line', opacity=1, symbology=None)#
Add a GeoPackage Vector Layer to the document.
- Parameters:
path (
str) – The path to the GeoPackage file to embed into the jGIS file.table_names (
list[str] |str|None) – A list of table names to create layers for.name (
str|None) – The name that will be used for the object in the document.type (
Literal['circle','fill','line']) – The type of the vector layer to create.opacity (
float) – The opacity, between 0 and 1.symbology (
GrammarSymbology|Layer|list[Mapping] |list[GrammarSymbology|Layer|list[Mapping] |tuple[Mapping,...]] |BaseModel|dict[str,Any] |None) – The symbology configuration to persist with the layers.
- add_geoparquet_layer(path, name=None, opacity=1, symbology=None)#
Add a GeoParquet Layer to the document.
- Parameters:
path (
str) – The path to the GeoParquet file to embed into the jGIS file.name (
str|None) – The name that will be used for the object in the document.opacity (
float) – The opacity, between 0 and 1.symbology (
GrammarSymbology|Layer|list[Mapping] |list[GrammarSymbology|Layer|list[Mapping] |tuple[Mapping,...]] |BaseModel|dict[str,Any] |None) – The symbology configuration to persist with the layer.
- add_geotiff_layer(url, min=None, max=None, name=None, normalize=True, wrapX=False, attribution='', opacity=1.0, symbology=None)#
Add a GeoTIFF layer.
- Parameters:
url (
str) – URL of the GeoTIFFmin (
int) – Minimum pixel value to be displayed, defaults to letting the map display set the valuemax (
int) – Maximum pixel value to be displayed, defaults to letting the map display set the valuename (
str|None) – The name that will be used for the object in the document, defaults to “GeoTIFF Layer”normalize (
bool) – Select whether to normalize values between 0..1, if false than min/max have no effect, defaults to TruewrapX (
bool) – Render tiles beyond the tile grid extent, defaults to Falseopacity (
float) – The opacity, between 0 and 1, defaults to 1.0symbology (
GrammarSymbology|Layer|list[Mapping] |list[GrammarSymbology|Layer|list[Mapping] |tuple[Mapping,...]] |BaseModel|dict[str,Any] |None) – The symbology configuration to persist with the layer.
- add_hillshade_layer(url, name=None, urlParameters=None, attribution='')#
Add a hillshade layer
- add_image_layer(url, coordinates, name=None, opacity=1)#
Add a Image Layer to the document.
- add_raster_layer(url, name=None, attribution='', opacity=1, url_parameters=None)#
Add a Raster Layer to the document.
- add_vectortile_layer(url, name=None, attribution='', min_zoom=0, max_zoom=24, opacity=1, symbology=None)#
Add a Vector Tile Layer to the document.
- Parameters:
name (
str|None) – The name that will be used for the object in the document.url (
str) – The tiles url.attribution (
str) – The attribution.opacity (
float) – The opacity, between 0 and 1.symbology (
GrammarSymbology|Layer|list[Mapping] |list[GrammarSymbology|Layer|list[Mapping] |tuple[Mapping,...]] |BaseModel|dict[str,Any] |None) – The symbology configuration to persist with the layer.
- add_video_layer(urls, name=None, coordinates=None, opacity=1)#
Add a Video Layer to the document.
- add_wms_tile_layer(url, layer_name, name=None, attribution='', opacity=1, interpolate=False)#
Add a WMS tile layer to the document.
- Return type:
- url:
Base WMS service URL (without SERVICE/REQUEST parameters), e.g. ‘https://ows.terrestris.de/osm/service’
- layer_name:
WMS layer name to request (from GetCapabilities Name).
- name:
Display name for the layer.
- attribution:
Optional attribution text.
- opacity:
Layer opacity in [0, 1].
- interpolate:
Whether to interpolate between grid cells when overzooming.
- get_wms_available_layers(wms_url, version='1.3.0', timeout=30.0)#
Fetch a WMS GetCapabilities document and parse available top-level layers.
Matches the behavior in the frontend WmsTileSourceUrlInput: - Calls: ?SERVICE=WMS&VERSION=…&REQUEST=GetCapabilities - Parses Capability > Layer (root Layer) - Returns direct child Layer elements with Name and Title.
Returns a list of objects shaped like: { ‘name’: <layer name>, ‘title’: <layer title> }.
- remove_layer(layer_id)#
Remove a layer from the GIS document.
- jupytergis.field(name)#
Create a field reference used by predicates and mapping chains.
Examples:
field("temperature").colormap("viridis").encoding("fill") when(field("magnitude") > 3).constant("red").encoding("fill")
- Return type:
- jupytergis.constant(value)#
Create a constant mapping source for chain-style symbology.
Finalize with
encoding(...)to create a mapping.- Return type:
- jupytergis.when(*when)#
Create a when-first builder for readable guarded mapping chains.
Examples:
when(field("mag") >= 5).constant("red").encoding("fill") when(field("mag") > 3, field("mag") < 8).when_op("all").field("mag").identity().encoding("radius")
- Return type:
- jupytergis.heatmap(*, radius=2.0, blur=5.0, weight_field=None, weight=None, mappings=None)#
Create a heatmap layer with KDE (kernel density estimation) transform.
- jupytergis.cluster(*, radius, mappings=None)#
Create a symbology that aggregates nearby points into clusters.
- jupytergis.geometry_type(value)#
Create a predicate that matches features by their geometry type.
- jupytergis.between(field, minimum, maximum)#
Create a predicate that matches features where a field value falls in a range.
The range is inclusive:
minimum <= field_value <= maximum.
- jupytergis.has_field(field)#
Create a predicate that matches features which have a given field.
- class jupytergis.GrammarSymbology(**data)#
Container for the normalized grammar symbology state.
Prefer constructing symbology via mapping chains and layer lists, then serializing with
to_symbology_state(...).- with_layer(item)#
Return a copy with one additional layer appended.
- Return type:
Self
- class jupytergis.VisualEncoding(allowed values: 'fill', 'stroke', 'radius', 'circle-fill', 'circle-stroke', 'pixel-rgba', 'circle-fill-color', 'circle-radius', 'circle-stroke-color', 'circle-stroke-width', 'fill-alpha', 'fill-blue', 'fill-color', 'fill-green', 'fill-red', 'pixel-alpha', 'pixel-blue', 'pixel-color', 'pixel-green', 'pixel-red', 'pixel-rgb', 'stroke-color', 'stroke-width')#
Allowed values: -
fill-stroke-radius-circle-fill-circle-stroke-pixel-rgba-circle-fill-color-circle-radius-circle-stroke-color-circle-stroke-width-fill-alpha-fill-blue-fill-color-fill-green-fill-red-pixel-alpha-pixel-blue-pixel-color-pixel-green-pixel-red-pixel-rgb-stroke-color-stroke-width
- jupytergis.VisualEncodings#
alias of
VisualEncoding|str|Sequence[VisualEncoding|str]
- class jupytergis.WhenBuilder(*, when, when_op=None)#
Start a mapping chain by declaring guard predicates first.
Use
when()to create instances, then choose a source withconstant()orfield().- constant(value)#
Start a constant mapping chain with the builder predicates attached.
- Return type:
- field(name)#
Start a field mapping chain with the builder predicates attached.
- Return type:
- when_op(when_op)#
Set the logical combinator for this builder’s predicates.
- Return type:
- class jupytergis.FieldPredicate(name)#
Fluent predicate builder for when= guards.
Use
fieldto construct instances. Rich comparisons return schema predicate objects, for examplefield("magnitude") > 3.- between(minimum, maximum)#
Build an inclusive numeric range predicate.
- categorical(colormap='viridis', *, n_shades=None, reverse=None, fallback=(0.0, 0.0, 0.0, 1.0))#
Apply a categorical scale to this field before
encoding(...).- Return type:
- colormap(colormap='viridis', *, domain=None, n_shades=9, mode=ClassificationMode.EQUAL_INTERVAL, reverse=False, fallback=(0.0, 0.0, 0.0, 1.0))#
Apply a color-ramp scale to this field before
encoding(...).- Return type:
- exists()#
Build a predicate that checks field existence.
- Return type:
- Returns:
A
hasFieldpredicate.
- identity()#
Apply an identity scale to this field before
encoding(...).- Return type:
- scalar(*, domain, output_range, fallback=None, scalar_stops=None)#
Apply a scalar interpolation scale to this field before
encoding(...).- Return type:
- class jupytergis.Predicate#
User-facing predicate value for
when=guards.Build these via helpers such as
field(...)comparisons,geometry_type(...),has_field(...), andbetween(...), then pass them to thewhen=argument of symbology functions.
- class jupytergis.ScalarStop(stop, output)#
User-facing scalar interpolation stop.
Use this with
scalar(..., scalar_stops=[...])to define explicit stop-to-output mappings.
- class jupytergis.ClassificationMode(allowed values: 'equal interval', 'quantile', 'jenks', 'pretty', 'logarithmic')#
Allowed values: -
equal interval-quantile-jenks-pretty-logarithmic
- class jupytergis.Layer(mappings=None, *, preprocess=None)#
A single symbology layer made of mapping chains.
- when(*when)#
Attach layer-level predicates.
- class jupytergis.Mapping(rule)#
Final mapping produced by
...encoding(...)chains.
- class jupytergis.MappingChain(*, kind, value, scale=None, scale_kind=None, when=None, when_op=None)#
Fluent chain for building a single mapping.
A mapping chain starts from
field(...)orconstant(...), optionally applies a scale (identity,colormap,categorical,scalar), and is finalized withencoding(...).- categorical(colormap='viridis', *, n_shades=None, reverse=None, fallback=(0.0, 0.0, 0.0, 1.0))#
Apply a categorical scale to a
field(...)source.- Parameters:
colormap (
str) – Name of the categorical color ramp.- Return type:
- Returns:
The updated
MappingChain.- Raises:
TypeError – If the source was created with
constant().
- colormap(colormap='viridis', *, domain=None, n_shades=9, mode=ClassificationMode.EQUAL_INTERVAL, reverse=False, fallback=(0.0, 0.0, 0.0, 1.0))#
Apply a color-ramp scale to a
field(...)source.- Parameters:
colormap (
str) – Ramp name (for example"viridis").n_shades (
int) – Number of discrete shades to produce.mode (
ClassificationMode) – The interpolation mode.reverse (
bool) – Whether to reverse the ramp order.fallback (
tuple[float,float,float,float] |Sequence[float] |str) – Fallback RGBA/color value.
- Return type:
- Returns:
The updated
MappingChain.- Raises:
TypeError – If the source was created with
constant().
- identity()#
Apply an identity scale to a
field(...)source.- Return type:
- Returns:
The updated
MappingChain.- Raises:
TypeError – If the source was created with
constant().
- scalar(*, domain, output_range, fallback=None, scalar_stops=None)#
Apply a scalar interpolation scale to a
field(...)source.- Return type:
- Returns:
The updated
MappingChain.- Raises:
TypeError – If the source was created with
constant().
- when(*when)#
Attach guard predicate(s) to this mapping chain.
- Return type:
- when_op(when_op)#
Set the logical combinator used for mapping
whenpredicates.- Return type: