Sorry, you need to enable JavaScript to visit this website.

Dynamic Layer Ordering

Dynamic Layer Ordering

You can change the z-order of the layers dynamically on the map to make the layers important to your use case visible on top of other layers.

Sample use case : You placed images on the map in your app but your users can bring the route and the road network on top of the images to see how the route looks like in details.



image

Images layer moved to the front

_

// layersImages = tomtomMap.getStyleSettings().findLayersById(IMAGE_LAYER_ID + "[0-9]");
// Layer imgLayer = layersImages.get(...)
// tomtomMap.getStyleSettings().moveLayerBehind(layer.getId(), "");
layersHelper.moveLayerToFront(imgLayer);
//REFERENCE_LAYER = ""
tomtomMap.styleSettings.moveLayerBehind(layer.id, REFERENCE_LAYER)


image

GeoJson layer with line moved to the front

_

// layerGeoJson = tomtomMap.getStyleSettings().findLayerById("layer-line-id").orNull();
// tomtomMap.getStyleSettings().moveLayerBehind(layerGeoJson.getId(), "");
layersHelper.moveLayerToFront(layerGeoJson);
//REFERENCE_LAYER = ""
tomtomMap.styleSettings.moveLayerBehind(layer.id, REFERENCE_LAYER)


image

Roads layer moved to the front

_

// layersRoads = tomtomMap.getStyleSettings().findLayersById(".*[rR]oad.*|.*[mM]otorway.*");
// Layer roadLayer = layersRoads.get(...)
tomtomMap.getStyleSettings().moveLayerBehind(roadLayer.getId(), "");
//REFERENCE_LAYER = ""
tomtomMap.styleSettings.moveLayerBehind(layer.id, REFERENCE_LAYER)

You are here