Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Below is my code based on ‘Cloud Based Map Styling" for the Google Maps Javascript API?’: 

let map;

function initMap() {

  map = new google.maps.Map(document.getElementById("map"), {

    mapId: "t43vt7y4ct837ytv", //not my real Map ID

    disableDefaultUI: true,

    center: { lat: 51.4765924, lng:  -0.003 },

    zoom: 15.5

  });

}

Can anyone tell me how to use Map ID when I  associate with the styling?

1 Answer

0 votes
by (19.7k points)

See the code below to supply the Map ID with the map_ids query parameter in the url of the script loading: 

<script src="https://maps.googleapis.com/maps/api/js?key=KEY&v=weekly&callback=yourInitMapMethod&map_ids=abcd1234mymapid,efgh5678myothermap"> </script>

Interested in Java? Check out this Java tutorial by Intellipaat. 

Browse Categories

...