Skip to content

Instantly share code, notes, and snippets.

@suzker
Created October 5, 2012 03:22
Show Gist options
  • Save suzker/3837867 to your computer and use it in GitHub Desktop.
Save suzker/3837867 to your computer and use it in GitHub Desktop.
coord filter logic in javascript
<!-- Suzker -->
<!DOCTYPE html>
<html>
<head>
<title>Compute Distance by the Routing Service</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map_canvas {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="js/RouteServWrap.js"></script>
<script>
var themap;
var pg;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(37.29966666666667, -121.94883333333334),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
themap = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
rte = new RouteServWrap(themap);
// demo of filtering coords
var mPoints = [new google.maps.LatLng(37.29966666666667, -121.94883333333334)
,new google.maps.LatLng(37.29416666666667, -121.94083333333333)
,new google.maps.LatLng(37.29416666666667, -121.94033333333333)
,new google.maps.LatLng(37.288666666666664, -121.93466666666667)
,new google.maps.LatLng(37.1, -121.14333333333333)
,new google.maps.LatLng(37.102833333333336, -121.13616666666667)
,new google.maps.LatLng(37.10033333333333, -121.12833333333333)
,new google.maps.LatLng(37.086666666666666, -121.11166666666666)
,new google.maps.LatLng(37.025166666666664, -120.9395)
,new google.maps.LatLng(37.02333333333333, -120.93783333333333)
,new google.maps.LatLng(37.019666666666666, -120.93416666666667)
,new google.maps.LatLng(36.63883333333333, -120.6265)
,new google.maps.LatLng(36.638666666666666, -120.62616666666666)
,new google.maps.LatLng(34.66116666666667, -118.757)
,new google.maps.LatLng(34.65983333333333, -118.756)
,new google.maps.LatLng(34.657, -118.755)
,new google.maps.LatLng(34.1015, -118.34116666666667)
,new google.maps.LatLng(34.1015, -118.34116666666667)
,new google.maps.LatLng(34.1015, -118.341)
,new google.maps.LatLng(34.10216666666667, -118.33966666666667)
,new google.maps.LatLng(34.05466666666667, -118.23333333333333)
,new google.maps.LatLng(34.05466666666667, -118.23333333333333)
,new google.maps.LatLng(34.054833333333335, -118.23316666666666)
,new google.maps.LatLng(33.943, -118.28)
,new google.maps.LatLng(33.943, -118.28)
,new google.maps.LatLng(33.9315, -118.2805)
,new google.maps.LatLng(33.9315, -118.2805)
,new google.maps.LatLng(33.94, -118.402)];
rte.setWayPoints(mPoints);
}
google.maps.event.addDomListener(window, 'load', initialize);
</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