Skip to content

Instantly share code, notes, and snippets.

@mrzmyr
Created December 9, 2013 11:37
Show Gist options
  • Save mrzmyr/7870973 to your computer and use it in GitHub Desktop.
Save mrzmyr/7870973 to your computer and use it in GitHub Desktop.
Google Maps Polyline Example
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple Polylines</title>
<style>
html, body, #map {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"></script>
<script>
function initialize() {
var mapOptions = {
zoom: 15,
center: new google.maps.LatLng(53.566853, 9.988269),
mapTypeId: google.maps.MapTypeId.ROADMAP_
};
var map = new google.maps.Map(document.getElementById('map'), mapOptions);
var myCoordinates = [
new google.maps.LatLng(53.561011,9.989448),
new google.maps.LatLng(53.563203,9.985800),
new google.maps.LatLng(53.564579,9.983525),
new google.maps.LatLng(53.566873,9.980822),
new google.maps.LatLng(53.567943,9.982152),
new google.maps.LatLng(53.570186,9.984813),
new google.maps.LatLng(53.572683,9.986143),
new google.maps.LatLng(53.572658,9.988675),
new google.maps.LatLng(53.572709,9.990392)
];
var polyOptions = {
path: myCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1,
strokeWeight: 3
}
var it = new google.maps.Polyline(polyOptions);
it.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment