To add a custom layer from an external source (e.g. vector, raster) you can use
the mapengine's MapSource which employs
MapLibre's Source.
In the following example, the WMS raster layer Flurstücke from ALKIS Brandenburg (WMS) is added.
Adjust the tile URL to your needs, see the WMS GetCapabilities (GetCapabilities for this example) for supported parameter values.
MAP_ENGINE_SOURCES = [
setup.MapSource(
name="bb_flurstuecke",
type="raster",
tiles=[
"https://isk.geobasis-bb.de/ows/alkis_wms"
"?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.3.0&request=GetMap&crs=EPSG:3857&"
"styles&width=768&height=768&transparent=true&layers=adv_alkis_flurstuecke",
],
),
]
MAP_ENGINE_LAYERS = [
setup.MapLayer(id="bb_flurstuecke", source="bb_flurstuecke", style={"type": "raster"}),
]You will also need a style definition for the layer in your layer-style JSON file, e.g.
{
"bb_flurstuecke": {
"type": "fill",
"paint": {
"fill-color": "#000000",
"fill-opacity": 0.8
}
}
}On WMS see also: