Map with building heights
Allow your users to see a map either in 2.5D with building heights enabled, or in 2D with building footprints.
Sample use case: Your application provides the possibility to display sophisticated visualization of the map with building heights (2.5D map), as well as displaying the map with building footprints (2D map).
The building heights data are available in Vector Map Tiles. The default TomTom map styles enable the display of building heights by default, but this can be disabled by switching off layers in the style.
Have a look at the detailed documentation for more related information at Vector Map Tiles and Map Style
In order to disable the display of the building heights you need to switch off corresponding layers in the style. That means that the following layers would need to be switched off in the default TomTom style: "Subway Station 3D", "Place of worship 3D", "Railway Station 3D", "Government Administration Office 3D", "Other building 3D", "School building 3D", "Other town block 3D", " Factory building 3D", "Hospital building 3D", "Hotel building 3D", and "Cultural Facility 3D. This will work in runtime.
1val LAYERS_IN_3D_REGEX = listOf(2 "Subway Station 3D",3 "Place of worship 3D",4 "Railway Station 3D",5 "Government Administration Office 3D",6 "Other building 3D",7 "School building 3D",8 "Other town block 3D",9 "Factory building 3D",10 "Hospital building 3D",11 "Hotel building 3D",12 "Cultural Facility 3D")13 .joinToString(separator = "|")
Use the following code snippets in your app to display building footprints (i.e., switch building heights off):
1val layers = tomtomMap.styleSettings.findLayersById(LAYERS_IN_3D_REGEX)2layers.forEach { layer ->3 layer.visibility = Visibility.NONE4}
Use the following code snippets in your app to display building heights (i.e., switch building heights back on):
1val layers = tomtomMap.styleSettings.findLayersById(LAYERS_IN_3D_REGEX)2layers.forEach {3 it.visibility = Visibility.VISIBLE4}
Switching the heights on | Switching the heights off |