JSFiddle - React, Tailwind, and code Playground

by priyanka tiwari

HTML

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>	
<div style="height:500px; width:400px; border:1px solid #000; background-color:white;" id="mappopup">
				</div>
		</div>

JavaScript

var citymap = {};
citymap['london'] = {
  center: new google.maps.LatLng(51.5072, 0.1275),
  population: 14856
};


var cityCircle;

function initialize() {
  // Create the map.
  var mapOptions = {
    zoom: 10,
    center: new google.maps.LatLng(51.5072, 0.2275),
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var map = new google.maps.Map(document.getElementById('mappopup'),
      mapOptions);

  // Construct the circle for each value in citymap.
  // Note: We scale the area of the circle based on the population.
  for (var city in citymap) {
    var populationOptions = {
      strokeColor: '#FF0000',
      strokeOpacity: 0.8,
      strokeWeight: 2,
      fillColor: '#FF0000',
      fillOpacity: 0.35,
	   draggable: true,
      map: map,
      center: citymap[city].center,
      radius: Math.sqrt(citymap[city].population) * 100
    };
    // Add the circle for this city to the map.
    cityCircle = new google.maps.Circle(populationOptions);
  }
}

google.maps.event.addDomListener(window, 'load', initialize);