Created
December 1, 2011 21:23
-
-
Save seeingidog/1419984 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function initialize() { | |
var flightPlanCoordinates = new Array(); | |
var myLatLng = new google.maps.LatLng(0, 0); | |
var myOptions = {zoom: 6, center: myLatLng, mapTypeId: google.maps.MapTypeId.TERRAIN}; | |
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); | |
var geocoder = new google.maps.Geocoder; | |
- @coordinates.each do |c| | |
geocoder.geocode( { 'address': "#{c.location}"}, function(results, status) { | |
if (status == google.maps.GeocoderStatus.OK) { | |
map.setCenter(results[0].geometry.location); | |
var marker = new google.maps.Marker({map: map,position: results[0].geometry.location, title: "#{c.name}"}); | |
flightPlanCoordinates.push(results[0].geometry.location); | |
} | |
}); | |
alert(flightPlanCoordinates); | |
var flightPath = new google.maps.Polyline({path: flightPlanCoordinates, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2}); | |
flightPath.setMap(map); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment