Google Maps Platform offers Cloud-based maps styling features that make it easy to style, customize, and manage your maps using the Google Cloud Console, letting you improve the overall user experience of your maps. To make these features easy to adopt and manage, Cloud-based maps styling brings a number of new tools to the Cloud Console:
- A style editor for easy style creation.
- Map ID creation and management.
- Custom map style creation and management.
- Tools for dynamic updating of styles.
Adding a Map ID to your app
A Map ID is an identifier that's associated with a specific map style or feature. Configure a map style and associate it with a Map ID in the Google Cloud Console. Then, when you reference a Map ID in your code, its associated map style is displayed in your app. Any subsequent style updates you make appear in your app automatically, without the need for any updates by your customers.
To instantiate a map using a Map ID, do the folowing:
- Create a
GMSMapIDwith the Map ID string from Cloud Console.
- Create a
GMSMapViewspecifying the Map ID you just created.
let camera = GMSCameraPosition(latitude: 47.0169, longitude: -122.336471, zoom: 12) let mapID = GMSMapID(identifier: "<YOUR MAP ID>") let mapView = GMSMapView(frame: .zero, mapID: mapID, camera: camera) self.view = mapView
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:47.0169 longitude:-122.336471 zoom:12]; GMSMapID *mapID = [GMSMapID mapIDWithIdentifier:@"<YOUR MAP ID>"]; GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero mapID:mapID camera:camera]; self.view = mapView;
If you are using your own Map ID, you can set your Map ID in the Cloud Console to have a new style at any time, and that style will be reflected on your map view automatically for you and users within about six hours.
If you want to see the changes immediately, you can close out and restart your app by exiting the app, forcing a quit of the app from the recently-used apps list, and then reopening it. The updated map will then be visible.
Using the maps style editor
The Maps Style editor is a GUI-based tool available in the Google Cloud Console.