Skip to main content

Mappls Map style

Mappls offers a range of preset styles to rendering the map. The user has to retrieve a list of styles for a specific account.
The listing api would help in rendering specific style as well as facilitate the switching of style themes.

From the below reference code it would become quite clear that user has to specify style names and not URLs to use them.
A default style is set for all account users to start with.
To know more about available styles, kindly contact apisupport@mappls.com

List of Available Styles

Explore and choose from our map style list on Live Demo

To get the list of available styles:

Java

List<MapplsStyle> styleList = mapplsMap.getMapplsAvailableStyles();  

Kotlin

val styleList = mapplsMap.getMapplsAvailableStyles() 

MapplsStyle contains below parameters:

  1. description(String): Description of the style
  2. displayName(string): Generic Name of style mostly used in Mappls content.
  3. imageUrl(String): Preview Image of style
  4. name(String): Name of style used to change the style.

Set Mappls Style

To set Mappls Maps style reference code is below:

Java

mapplsMap.setMapplsStyle(name, new OnStyleLoadListener() {    
@Override
public void onError(String error) {
Toast.makeText(MapActivity.this, error, Toast.LENGTH_SHORT).show();
}

@Override
public void onStyleLoaded(Style styles) {
Toast.makeText(MapActivity.this, "onStyleLoaded", Toast.LENGTH_SHORT).show();

} });
//OR
mapplsMap.setMapplsStyle(name);

Kotlin

mapplsMap.setMapplsStyle(style, object : OnStyleLoadListener {  
override fun onError(p0: String?) {
Toast.makeText(this@MainActivity, p0, Toast.LENGTH_LONG).show()
}
override fun onStyleLoaded(style: Style) {
Toast.makeText(this@MainActivity, "Style loaded Successfully", Toast.LENGTH_LONG).show()
}
})
//OR
mapplsMap.setMapplsStyle(name)

To enable/disable last selected style

To enable/disable loading of last selected style:

Java

MapplsMapConfiguration.getInstance().setShowLastSelectedStyle(false); //true is enable & false is disable(default value is true) 

Kotlin

MapplsMapConfiguration.getInstance().setShowLastSelectedStyle(false) //true is enable & false is disable(default value is true)  

Get Selected style

To get the currently selected style name:

Java

mapplsMap.getStyle().getMapplsStyle();  

Kotlin

mapplsMap.style.getMapplsStyle()