Google Map Styling

Updated 31 July 2019

Save

Setting the map style

Setting the map style is pretty simple to do within your application. Once you’ve got access to the map instance that you wish to theme, you can simple use the setMapStyle() method to pass in either a JSON string (maybe a value sent from your server or a users preference) or a RAW JSON file from your resources directory. We can then set this like so:

Within this JSON we can declare two main parts of the Google Map component to modify the styling, these are:

Luckily for us, Google provide a handy tool to create this JSON file

Using the Google Maps Styling Wizard

Introducing the Google Map Styling Wizard — go check it out, it basically does all of the hard work for us!

We can do a number of things with this tool, such as adjust the density of the roads:

After clicking on finish it will create a json file.

First define map styles in JSON format and save the styles JSON file in res/raw folder. The following section gives detailed information about Google map style elements and how to define the styles.

You can change the color code in it and send create your own styled Google Map.

Map style defined in JSON can be applied to GoogleMap object by calling setMapStyle method and passing resource identifier of the style as shown below.

 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home