gws.lib.mapserver.core¶
MapServer map wrapper.
Source code: gws.lib.mapserver.core
Module Contents¶
- class gws.lib.mapserver.core.Map(config: str = '')¶
Wrapper around a
mapscript.mapObj.MapServer errors are written to stderr.
- mapObj: mapscript.mapObj¶
The wrapped MapServer map object.
- add_layer(opts: gws.MapServerLayerOptions) mapscript.layerObj¶
Add a layer to the map from layer options.
The layer is named
_gws_<n>and switched on.- Parameters:
opts – Layer options.
crsis required.- Returns:
The new MapServer layer object.
- Raises:
Error – If the CRS is missing, the connection type is not supported, or MapServer cannot create the layer.
- add_layer_from_config(config: str) mapscript.layerObj¶
Add a layer to the map from a mapfile
LAYERblock.- Parameters:
config – Layer configuration in the mapfile syntax.
- Returns:
The new MapServer layer object.
- Raises:
Error – If MapServer cannot create the layer.
- draw(bounds: gws.Bounds, size: gws.Size) gws.Image¶
Render the map as a transparent PNG.
- Parameters:
bounds – Extent and CRS to render.
size – Image size
(width, height)in pixels.
- Returns:
The rendered image.
- Raises:
Error – If MapServer cannot render the map.
- style_symbol(style: gws.StyleValues) mapscript.styleObj¶
Create a MapServer marker style from style values.
The marker symbol is looked up by name in the symbol set of the map.
- Parameters:
style – Style values with
markerand optionalmarker_*values.- Returns:
A MapServer style object.