Skip to main content

OpenStreetMaps

Header

Level: Intermediate

Keywords: map, OSM, OpenStreetMaps, base layer, SAMO Browse

The result: visible base OpenStreetMaps map layer in SAMO Browse.

How to add OpenStreetMaps layer to SAMO Map?

The OpenStreetMap layer is often used on projects as it is distributed under the Creative Commons license and is very easy to configure. Compared to other layers, it does not need any configuration of LIDS metadata, only SAMO metadata.

Choose corresponding layer based on the coordinate system and providing web service

First of all, in order to configure any layer, you need to know which coordinate system is used by your project.

Second, you need to decide, what type of layer you want to use in terms of the providing web service. OpenStreetMaps are accessible from the Asseco server as WMS, WMTS and TMS layers.

Configure the layer in samo-map.json

As soon as you've decided what layer you want to use, you can start with the configuration. From the Asseco server you will need only two parameters: layerName (based on your chosen coordinate system) and type (based on the providing web service). Otherwise, your configuration will be very similar to the following example. This layer configuration has to be added to the layers object in samo-map.json.

base OSM layer - configuration example
"baseOSM": {
"title": "OpenStreetMaps",
"type": "lids-map-layer-wmts",
"visible": true,
"optional": true,
"properties": {
"layerName": "GaussKrugerZone3",
"autoConfiguration": true,
"url": "https://maps.samo-asseco.com/mapproxy/service"
}
}

Add the layer to the specific SAMO Browse.

Adding the layer configuration to the samo-map.json only means, that it is available for use throughout your SAMO application. For adding this layer to your specific SAMO Browse, you need to include it in the enabledLayers array.

include OSM layer in SAMO Browse - configuration example
"map": {
"extends": "default",

"enabledLayers": [
"baseTMS",
"baseOSM"
]
}