Mappls Map style¶
Mappls offers a variety of preset map styles for rendering your maps. To use these styles, you need to retrieve the list of available styles associated with your account. The listing API helps you both render a specific style and easily switch between different style themes.
From the reference code below, it’s clear that you specify style names, not URLs, when applying styles. Every account starts with a default style to get you up and running quickly.
For a complete list of available styles or further assistance, please contact apisupport@mappls.com.
List of Available Styles¶
Explore different map styles Mappls offer Live Demo
To get the list of available styles:
Kotlin¶
val styleList = mapplsMap.mapplsAvailableStyles
Java¶
List<MapplsStyle> styleList = mapplsMap.getMapplsAvailableStyles();
MapplsStyle
contains below parameters:
displayName(string)
: Generic Name of style mostly used in Mappls content.imageUrl(String)
: Preview Image of stylename(String)
: Name of style used to change the style.
Set Mappls Style¶
To set Mappls Maps style reference code is below:
Kotlin¶
mapplsMap.setMapplsStyle(style, object : OnStyleLoadListener {
override fun onError(p0: String?) {
}
override fun onStyleLoaded(style: Style) {
}
})
//OR
mapplsMap.setMapplsStyle(name)
Java¶
mapplsMap.setMapplsStyle(name, new OnStyleLoadListener() {
@Override
public void onError(String error) {
}
@Override
public void onStyleLoaded(Style styles) {
} });
//OR
mapplsMap.setMapplsStyle(name);
To enable/disable last selected style¶
To enable/disable loading of last selected style:
Kotlin¶
MapplsMapConfiguration.getInstance().isShowLastSelectedStyle = false //true is enable & false is disable(default value is true)
Java¶
MapplsMapConfiguration.getInstance().setShowLastSelectedStyle(false); //true is enable & false is disable(default value is true)
Get Selected style¶
To get the current style name in use:
Kotlin¶
val mapplsStyle = mapplsMap.style?.mapplsStyle
Java¶
String mapplsStyle = mapplsMap.getStyle().getMapplsStyle();
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!