Created
August 9, 2014 19:02
-
-
Save Sephiroth-XIII/816aae0f2b9a425de59a to your computer and use it in GitHub Desktop.
Plot Latitude and Longitude from CSV File
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<title>Simple markers</title> | |
<style> | |
html, body, #map-canvas | |
{ | |
height: 100%; | |
margin: 0px; | |
padding: 0px | |
} | |
</style> | |
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> | |
<script src="jquery.min.js"></script> | |
<script src="jquery.csv-0.71.min.js"></script> | |
<script> | |
$.ajax({ | |
url: "cords.csv", | |
aync: false, | |
success: function (csvd) { | |
LatLng = $.csv2Array(csvd); | |
}, | |
dataType: "text", | |
complete: function () | |
{ | |
var mapOptions = | |
{ | |
zoom: 2, | |
center: new google.maps.LatLng(0,0) | |
}; | |
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); | |
for (var i = 0; i < LatLng.length; i++) | |
{ | |
var myLatlng = new google.maps.LatLng(LatLng[i][0],LatLng[i][1]); | |
var marker = new google.maps.Marker({ | |
position: myLatlng, | |
map: map | |
}); | |
}; | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="map-canvas"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment