Document Maps SDK for Android Guides Map Map Styling

Map Styling

Introduction

Starting with Android 3D Map SDK v5.2.0, the AMAP SDK supports custom map styles that let you change the base map colors and appearance using visual templates. This feature enables visual editing and control over which map elements are displayed.

Create a Style File

Create a Map Style

After obtaining a developer account on the AMAP Platform, you can create a map style by following these steps:

1. Go to the Developer Console.

2. Navigate to the Map Customization Platform.

3. Click Create Map Style.

4. Select a template to start with.

AMAP map style creation console interface with template options for starting a custom map style

Edit a Map Style

On the style editing page, you can edit style properties in two ways:

- Select an element from the list on the left side of the page.

- Click a feature directly on the map, then choose the element from the pop-up list.

Map style editor interface showing element-level customization with click-to-select on the map preview

Publish and Download the Style File

After editing is complete:

1. Click Save in the upper-right corner.

2. Click Publish.

3. After publishing, select Usage Method.

4. Choose the Android platform.

5. Click Download Offline File.

Publishing a custom map style from the AMAP style management console with download options

Downloading a published custom map style offline file from the AMAP console

Set the Style File

Note: Starting with Map SDK v6.6.0, the custom map style usage method has been significantly updated. See the documentation below for details.

Set an Offline Style File

1. In the console, go to My Map Styles and download the style file that matches your current Map SDK version.

Downloading an offline custom map style file matching the current Android Maps SDK version

2. The downloaded ZIP file has the following internal directory structure. Each file corresponds to a method in CustomMapStyleOptions:

File Name

Description

Corresponding Method

style_extra.data

Extended content, such as grid background color

CustomMapStyleOptions.setStyleExtraData() / setStyleExtraPath()

style.data

Style configuration data

CustomMapStyleOptions.setStyleData() / setStyleDataPath()

textures.zip

Texture images (ZIP file)

CustomMapStyleOptions.setStyleTextureData() / setStyleTexturePath()

Note: You can place the style files in any directory, for example /mnt/sdcard/amap.

// This method is available in the AMap class
aMap.setCustomMapStyle(
    new com.amap.api.maps.model.CustomMapStyleOptions()
        .setEnable(true)
        .setStyleDataPath("/mnt/sdcard/amap/style.data")
        .setStyleExtraPath("/mnt/sdcard/amap/style_extra.data")
        .setStyleTexturePath("/mnt/sdcard/amap/textures.zip")
);

Important: The texture feature requires [enabling the relevant permissions](/home/package?active=mapstyle).

Set an Online Style File (Requires Permission)

If downloading style files is too cumbersome, you can use the online method instead. This feature requires [enabling permissions](/home/package?active=mapstyle).

1. After publishing a new style on the customization platform, you receive a style ID. Use the SDK's setCustomMapStyleID method to apply it. To update the style, simply publish the changes and reload the map.

2. If both online and offline styles are set, the SDK attempts to fetch the online style first. If the fetch fails, it falls back to the offline style.

3. Example code:

// This method is available in the AMap class
aMap.setCustomMapStyle(
    new com.amap.api.maps.model.CustomMapStyleOptions()
        .setEnable(true)
        .setStyleId("your_style_id") // Obtain from Console > Custom Styles
);

Note: Textures are not supported for online fetching. If you use setStyleId, you must also set the texture using setStyleTexturePath for it to take effect.