Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (55 sloc) 2.08 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps GPX Test - async</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<!-- Make the document body take up the full screen -->
<style type="text/css">
html, body {width: 100%; height: 100%}
body {margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px}
</style>
<!-- Replace the key in the line below with an API key for your site. You can get one here http://www.google.com/apis/maps/signup.html -->
<script src="//maps.googleapis.com/maps/api/js?key=[YOUR KEY HERE]" type="text/javascript"></script>
<script src="../../loadgpx.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var MyMap;
function LoadGPXFileIntoGoogleMap(map, filename)
{
var request = new XMLHttpRequest();
request.open("GET", filename, true);
request.onreadystatechange = function()
{
if (request.readyState == 4)
{
parser = new GPXParser(request.responseXML, map);
parser.SetTrackColour("#ff0000"); // Set the track line colour
parser.SetTrackWidth(5); // Set the track line width
parser.SetMinTrackPointDelta(0.001); // Set the minimum distance between track points
parser.CenterAndZoom(request.responseXML); // Center and Zoom the map over all the points.
parser.AddTrackpointsToMap(); // Add the trackpoints
parser.AddWaypointsToMap(); // Add the waypoints
}
}
request.send(null);
}
function onLoad()
{
MyMap = new google.maps.Map(document.getElementById("map"), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
LoadGPXFileIntoGoogleMap(MyMap, "pocotrail.xml");
}
//]]>
</script>
</head>
<body onload="onLoad()">
<div id="map" style="width: 100%; height: 100%;"></div>
</body>
</html>