I need to retrieve all the latitude and longitude coordinates from Google Maps.
For instance: If I input the latitudes and longitudes of a source and destination, and a path is drawn on the map like below:
Now, I want to obtain all the latitude and longitude points between point A (source) and B (destination), and store them in a database.
If my car deviates from this path, I want it to trigger an action like sending me an email.
I am working on development using ASP.NET C#.
How can I retrieve all the latitude and longitude values?
I am currently utilizing the script below:
<script>
function initialize() {
var map = new google.maps.Map(document.getElementById('map_canvas'), {
zoom: 8,
center: new google.maps.LatLng(22.304634, 73.161070),
mapTypeId: google.maps.MapTypeId.ROADMAP
}),
directions = new google.maps.DirectionsService(),
displayer = new google.maps.DirectionsRenderer({
draggable: true
});
displayer.setMap(map);
directions.route({
origin: new google.maps.LatLng(22.304634, 73.161070),
destination: new google.maps.LatLng(23.022242, 72.548844),
travelMode: google.maps.DirectionsTravelMode.DRIVING
}, function (result) {
displayer.setDirections(result);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.addListener(displayer, 'directions_changed', some_method);
</script>