My programming knowledge is very limited and I'm working on a college project that includes programming.
What I want to do is a map, that shows your current location and the locations of recycling points. I already did the current location part, and I used the fusion tables to display the recycling points on the map. But I also wanted to give the option of finding the shortest route between your current location and the the recycling points.
So what it would do was to calculate the distance between your current location and every recycling point, and show the shortest one.
Right now I'm trying to understand google maps api tutorials and I don't know if this is possible, using the fusion tables. So I wanted to know if anyone knows how to do this.
Thank you so much!
<!DOCTYPE html>
<html>
<head>
<section id="wrapper">
Clique no botão "permitir" para deixar o browser encontrar a sua localização
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<article>
</article>
<script>
function success(position) {
var mapcanvas = document.createElement('div');
mapcanvas.id = 'mapcontainer';
mapcanvas.style.height = '350px';
mapcanvas.style.width = '450px';
document.querySelector('article').appendChild(mapcanvas);
var coords = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var options = {
zoom: 15,
center: coords,
mapTypeControl: false,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("mapcontainer"), options);
var marker = new google.maps.Marker({
position: coords,
map: map,
title:"You are here!"
});
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Coordenadas',
from: '1CwMDrcxebjsb8sjG42rbGVAZB25Zi7CvaLJXOCM'
},
});
layer.setMap(map)
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success);
} else {
error('Geo Location is not supported');
}
</script>
</section>
</head>
<body>
</body>
</html>