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

let layersImages = currentStyle.getLayersByRegex("img-id.*")
layersImages.forEach { currentStyle.moveLayer(toFront: sh) }
NSArray<TTMapLayer *> *layersImages = [self.currentStyle getLayersByRegex:@"img-id.*"]; for (TTMapLayer *layer in layersImages) {
[self.currentStyle moveLayerToFront:layer]; }

image

GeoJSON

let layerRoute = currentStyle.getLayerByID("layer-line-id")
currentStyle.moveLayer(toFront: layerRoute!)
TTMapLayer *layerRoute = [self.currentStyle getLayerByID:@"layer-line-id"];
[self.currentStyle moveLayerToFront:layerRoute]; break;

image

Roads

let layersRoads = currentStyle.getLayersBySourceLayerRegexs([".*[rR]oad.*", ".*[mM]otorway.*"])
layersRoads.forEach { currentStyle.moveLayer(toFront: sh) }
NSArray<TTMapLayer *> *layersRoads = [self.currentStyle getLayersBySourceLayerRegexs:[NSArray arrayWithObjects:@".*[rR]oad.*", @".*[mM]otorway.*", nil]]; for (TTMapLayer *layer in layersRoads) {
[self.currentStyle moveLayerToFront:layer]; }