Skip to content

Instantly share code, notes, and snippets.

@asapostolov
Created September 24, 2015 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asapostolov/35bb3e03b7f5dedaa000 to your computer and use it in GitHub Desktop.
Save asapostolov/35bb3e03b7f5dedaa000 to your computer and use it in GitHub Desktop.
City of Plovdiv's Center in Polygon
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple Polygon</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
// This example creates a simple polygon representing the Bermuda Triangle.
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 15,
center: {lat: 42.146152, lng: 24.748651},
mapTypeId: google.maps.MapTypeId.TERRAIN
});
// Define the LatLng coordinates for the polygon's path.
var triangleCoords = [
{ lat: 42.154709, lng: 24.739262 },
{ lat: 42.154655, lng: 24.754635 },
{ lat: 42.148127, lng: 24.764811 },
{ lat: 42.143639, lng: 24.754609 },
{ lat: 42.137317, lng: 24.751387 },
{ lat: 42.138554, lng: 24.745020 },
{ lat: 42.140354, lng: 24.742744 },
{ lat: 42.144382, lng: 24.745839 },
{ lat: 42.146361, lng: 24.736663 },
{ lat: 42.154709, lng: 24.739262 }
];
// Construct the polygon.
var bermudaTriangle = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35
});
bermudaTriangle.setMap(map);
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=API_KEY&signed_in=true&callback=initMap"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment