THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Dynamic Layer Ordering

You can dynamically change the z-order of the layers 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 what the route looks like in detail.

image

Images layer moved to the front

1// layersImages = tomtomMap.getStyleSettings().findLayersById(IMAGE_LAYER_ID + "[0-9]")
2// Layer imgLayer = layersImages.get(...)
3tomtomMap.getStyleSettings().moveLayerBehind(imgLayer.getId(), "");
//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(), "");
//REFERENCE_LAYER = ""
tomtomMap.styleSettings.moveLayerBehind(layer.id, REFERENCE_LAYER)

image

Roads layer moved to the front

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