gws.base.layer.core¶
Base layer object and the configuration shared by all layers.
Source code: gws.base.layer.core
Module Contents¶
- class gws.base.layer.core.AutoLayersConfig(*args, **kwargs)¶
Bases:
gws.ConfigWithAccessConfiguration merged into automatically created layers that match a filter.
- applyTo: gws.gis.source.LayerFilter | None¶
Filter for the source layers the configuration applies to.
- config: dict¶
Layer configuration to merge into each matching layer.
- class gws.base.layer.core.ClientConfig(*args, **kwargs)¶
Bases:
gws.DataDisplay options for the layer in the client layer tree.
Hide the layer on the map initially.
- treeClassName = ''¶
CSS class for the layer’s item in the layer tree.
- class gws.base.layer.core.ClientOptions(*args, **kwargs)¶
Bases:
gws.DataClient options for a layer.
A layer is initially hidden.
- class gws.base.layer.core.Config(*args, **kwargs)¶
Bases:
gws.ConfigWithAccessLayer configuration
- cache: gws.gis.cache.LayerConfig | None¶
Tile cache options.
- clientOptions: ClientConfig | None¶
Display options in the client layer tree.
- display: gws.LayerDisplayMode¶
The way the layer is rendered in the client.
- extent: gws.Extent | None¶
Layer extent in map CRS coordinates, clipped to the parent extent.
- finders: list[gws.ext.config.finder] | None¶
Search providers for the layer’s features.
- grid: dict | None¶
Ignored. (deprecated in 8.5)
- imageFormat: gws.lib.image.FormatConfig | None¶
Format of rendered and cached images.
- legend: gws.ext.config.legend | None¶
Custom legend or legend options for the layer.
- loadingStrategy: gws.FeatureLoadingStrategy¶
When the client loads the layer’s features.
- metadata: gws.base.metadata.Config | None¶
Layer metadata.
- models: list[gws.ext.config.model] | None¶
Data models for the layer’s features.
- ows: Config.ows | None¶
Layer names, namespace and allowed services for OWS services.
- templates: list[gws.ext.config.template] | None¶
Templates for the layer’s description and feature info.
- zoom: gws.gis.zoom.Config | None¶
Scales or zoom levels at which the layer is visible.
- zoomExtent: gws.Extent | None¶
Extent to zoom to when zooming to the layer.
- gws.base.layer.core.DEFAULT_IMAGE_FORMAT¶
- class gws.base.layer.core.Object¶
Bases:
gws.LayerBase layer.
Provides the attributes common to all layers, the configuration protocol
configure_layer, client props and the URLs of the map action commands. Subclasses callconfigure_layerfrom theirconfiguremethod, override theconfigure_*steps they need and implementrender_box,render_tileorrender_svgfor the outputs they support.- canRenderBox = False¶
The layer can render a single image for an arbitrary extent.
- canRenderInClient = False¶
The layer can be drawn by the client directly from its source (
display: client).
- canRenderSvg = False¶
The layer can render its features as SVG.
- canRenderTile = False¶
The layer can render tiles in a fixed grid.
- clientOptions: ClientOptions¶
Display options for the client layer tree.
- hasLegend = False¶
The layer has a legend.
- isEnabledForOws = False¶
The layer can be used by OWS services.
- isGroup = False¶
The layer is a group of other layers.
- isSearchable = False¶
The layer has at least one search provider.
- parentWgsExtent: gws.Extent¶
WGS84 extent of the parent layer or map.
- configure()¶
Configuration hook.
Called when the node is initialized. Raising an exception here aborts the creation of the node.
- configure_bounds()¶
Set
boundsin the map CRS.The bounds are the WGS extent clipped to the parent extent and to the CRS. If the extent lies outside of the parent extent, a configuration warning is issued and the parent extent is used.
- Returns:
True.- Raises:
gws.ConfigurationError – If no extent can be determined.
- configure_extent()¶
Set
wgsExtentfrom the configuredextent.- Returns:
Trueif an extent is configured,Noneotherwise.- Raises:
gws.ConfigurationError – If the configured extent is invalid.
- configure_group()¶
Create child layers. Does nothing in the base class.
- Returns:
Trueif child layers were created,Noneotherwise.
- configure_layer()¶
Run the layer configuration steps in a fixed order.
The steps are provider, sources, group, models, extent, bounds, zoom bounds, resolutions, legend, metadata, templates, search and OWS.
- configure_legend()¶
Create the legend from the
legendconfiguration.- Returns:
Trueif a legend is configured or legends are disabled withwithLegend,Noneotherwise.
- configure_metadata()¶
Set
metadatafrom themetadataconfiguration.- Returns:
Trueif metadata is configured,Noneotherwise.
- configure_models()¶
Create the models from the
modelsconfiguration.- Returns:
Trueif models are configured,Falseotherwise.
- configure_ows()¶
Create the OWS binding and set
isEnabledForOwsfromwithOws.The OWS layer and feature names default to the layer title converted to a UID.
- configure_provider()¶
Set up the data provider. Does nothing in the base class.
- Returns:
Trueif a provider was configured,Noneotherwise.
- configure_resolutions()¶
Set
resolutionsfrom thezoomconfiguration.Without a
zoomconfiguration the layer keeps the parent resolutions.- Returns:
Trueif a zoom configuration is present,Noneotherwise.- Raises:
gws.Error – If the zoom configuration yields no resolutions.
- configure_search()¶
Create the search providers from the
findersconfiguration.- Returns:
Trueif finders are configured or search is disabled withwithSearch,Falseotherwise.
- configure_sources()¶
Set up the source layers. Does nothing in the base class.
- Returns:
Trueif sources were configured,Noneotherwise.
- configure_templates()¶
Create the templates from the
templatesconfiguration.- Returns:
Trueif at least one template was created,Falseotherwise.
- configure_zoom_bounds()¶
Set
zoomBoundsfrom the configuredzoomExtent.- Returns:
Trueif a zoom extent is configured,Noneotherwise.- Raises:
gws.ConfigurationError – If the configured zoom extent is invalid.
- find_features(search, user)¶
Find features in the layer.
Vector layers search in the first model the user can read; other layers return an empty list.
- Parameters:
search – Search query.
user – The user who searches.
- Returns:
Found features.
- post_configure()¶
Post-configuration hook.
Called after the whole object tree has been created.
- props(user)¶
Generate a
Propsstruct for this object.Do not call this method directly, use
gws.props_ofinstead, which also checks permissions.- Parameters:
user – The user for which the props should be generated.
- Returns:
A
Propsobject or a dict. Nested objects are converted to props as well.
- render(lri)¶
Render a box, a tile or an SVG fragment, depending on the input type.
- Parameters:
lri – Render input.
- Returns:
Render output with image content or SVG tags, or
Noneif the layer has nothing to render.
- render_box(lri)¶
Render the layer as a single image. Returns nothing in the base class.
- Parameters:
lri – Render input with the map view.
- Returns:
Render output with the encoded image, or
None.
- render_legend(args=None)¶
Render the layer legend.
Without
argsthe output is cached for the server lifetime.- Parameters:
args – Arguments passed to the legend renderer.
- Returns:
Legend output, or
Noneif the layer has no legend.
- render_svg(lri)¶
Render the layer as SVG. Returns nothing in the base class.
- Parameters:
lri – Render input with the map view and style.
- Returns:
Render output with SVG tags, or
None.
- render_tile(lri)¶
Render a single tile. Returns nothing in the base class.
- Parameters:
lri – Render input with the tile coordinates.
- Returns:
Render output with the encoded tile, or
None.
- class gws.base.layer.core.Props(*args, **kwargs)¶
Bases:
gws.PropsObject properties.
- clientOptions: ClientOptions¶
- extent: gws.Extent | None¶
- geometryType: gws.GeometryType | None¶
- grid: gws.lib.grid.Props¶
- loadingStrategy: gws.FeatureLoadingStrategy¶
- metadata: gws.base.metadata.Props¶
- model: gws.base.model.Props | None¶
- zoomExtent: gws.Extent | None¶