In this example, I will demonstrate how to create a covered area on a Map for specific scenarios something like where you need highlight the area based on the population, computer literacy, education...Etc. eg: You can change the size of the circle by covering the countries based on the highest population in the world. This article is more focusing on creating circles on Google Map Version 3. Creating a Polygon will be discussed in later article. Let's have a look on circle first,
Creating a Circle on the Map for given radius.
Follow these code snippets to create a circle and will create a marker on the center point of the circle. Read the code comments and API reference for more information. First I will create a map container within the body tag
<body> <div id="divMap" style="width:600px; height:600px; border:1px #000 solid"></div> </body>
Step 01 -:- Creating a map.
var divMap = document.getElementById('divMap'); // get the id of the map container.
var mapOptions =
{
zoom : 8,
mapTypeId : google.maps.MapTypeId.ROADMAP,
center : new google.maps.LatLng(6.91752, 79.858246)
}
googleMap = new google.maps.Map(divMap, mapOptions);