Document Maps SDK for iOS Guides Map Map Styling

Map Styling

The AMAP iOS 3D Map SDK supports custom map styles, allowing you to change the base map colors and styles using visual templates. This feature, available since SDK v5.2.0, enables visual editing and control over which map elements are displayed.

Create a Style File

Create a Map Style

1. Log in to the AMAP Developer Console with your developer account.

2. Navigate to the Map Customization Platform.

3. Click Create Map Style and select a template to start from.

AMAP map style creation console with template options for custom map styling

Edit the Map Style

In the style editor, you can modify the properties of any map element in two ways:

- Select an element from the list on the left panel and edit its style properties.

- Click directly on the map, then select an element from the pop-up list to edit.

Map style editor interface showing element-level color and visibility customization

Publish and Download the Style

1. After editing, click Save in the top-right corner, then click Publish.

2. Once published, click Usage Instructions, select the iOS platform, and click Download Offline File.

Publishing a custom map style from the AMAP style management console

Downloading a published custom map style file from the AMAP console

Apply a Custom Style

Note: Starting with SDK v6.6.0, the method for applying custom map styles has been significantly updated. Refer to the documentation below for details.

Set an Offline Custom Style

1. In the AMAP Console, go to My Map Styles and select the style version that matches your current map SDK version. Download the style file.

Setting an offline custom map style by downloading the style file for iOS Maps SDK

2. The downloaded file is a ZIP archive with the following internal structure. Each file corresponds to a property in MAMapCustomStyleOptions.

File Name

Description

Property Name

style_extra.data

Extended content, such as grid background color.

styleExtraData

style.data

Specific style configuration.

styleData

textures.zip

Texture images (ZIP file).

styleTextureData

3. Apply the style using the following method:

/**
 * @brief Sets custom map style options. Supports hierarchical style configuration,
 *        such as displaying different colors at different zoom levels.
 * @param styleOptions Custom style options. Available since v6.6.0.
 */
- (void)setCustomMapStyleOptions:(MAMapCustomStyleOptions *)styleOptions;

Example Code:

NSString *path = [NSString stringWithFormat:@"%@/my_style_new.data", [NSBundle mainBundle].bundlePath];
NSData *data = [NSData dataWithContentsOfFile:path];
MAMapCustomStyleOptions *options = [[MAMapCustomStyleOptions alloc] init];
options.styleData = data;
[self.mapView setCustomMapStyleOptions:options];
[self.mapView setCustomMapStyleEnabled:YES];

Note: Texture functionality requires enabling the relevant permission.

Set an Online Custom Style

If you prefer not to download style files, you can use the online method. This requires enabling the relevant permission.

1. After publishing your style on the customization platform, you will receive a style ID. Use the SDK interface to apply this style. To update the style, simply re-publish it on the platform and reload the map.

2. If both an online style and an offline style are set, the SDK will attempt to fetch the online style first. If the online fetch fails, it will fall back to the offline style.

Example Code:

MAMapCustomStyleOptions *options = [[MAMapCustomStyleOptions alloc] init];
options.styleId = @"your_style_id";
[self.mapView setCustomMapStyleOptions:options];
self.mapView.customMapStyleEnabled = YES;

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