Last active
March 23, 2020 17:40
-
-
Save keyan/9115cc70a1a1757fb7ea8599fcc32b89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<hmtl> | |
<div id="map-canvas"></div> | |
<style> | |
html, body, #map-canvas { | |
height: 90%; | |
margin: 5px; | |
padding: 1px; | |
} | |
</style> | |
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=geometry,places&ext=.js"></script> | |
<script> | |
var map; | |
var distinct_colors = [ | |
'#e6194b', | |
'#3cb44b', | |
'#ffe119', | |
'#0082c8', | |
'#f58231', | |
]; | |
var lines = [ | |
'}tfcF~utiVmxAklBmxAklBoxAmlBmxAolBmxAmlBmxAolBmxAolBmxAqlBoxAqlBmxAqlB^S', | |
'}tfcF~utiVmxAklBmxAklBoxAmlBmxAolBmxAmlBmxAolBmxAolBmxAqlBoxAqlBmxAqlB^S', | |
]; | |
var markers = [ | |
{lat: 37.53782661923329, lng: -122.15943872227592}, | |
{lat: 37.53782662465645, lng: -122.16057286714346} | |
]; | |
function initialize() { | |
var mapOptions = { | |
zoom: 13, | |
center: { | |
lat: 37.784471, | |
lng: -122.407974 | |
} | |
}; | |
map = new google.maps.Map( | |
document.getElementById('map-canvas'), | |
mapOptions | |
); | |
for (var i in lines) { | |
console.log(lines[i]) | |
var decode = google.maps.geometry.encoding.decodePath(lines[i]); | |
new google.maps.Polyline({ | |
map: map, | |
path: decode, | |
strokeColor: distinct_colors[i], | |
strokeOpacity: 1.0, | |
strokeWeight: 4 | |
}); | |
} | |
for (var i in markers) { | |
new google.maps.Marker({ | |
position: markers[i], | |
map: map, | |
title: i | |
}) | |
} | |
} | |
google.maps.event.addDomListener(window, 'load', initialize); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment