Really need some ideas on this. Been working on Google map API, which I'm using Geocoding, Reverse Geocoding and Geolocation. With this piece of code, below,I am able to use Direction API of Google map, which works perfectly.
var locations = [
{lat: 6.4261139, lng: 3.4363691}
];
var mapContainer = $('.map-container'),
map = new google.maps.Map(mapContainer[0], {
center: center,
zoom : 10
});
var markers = _(locations)
.map(function (loc) {
return new google.maps.Marker({
position: new google.maps.LatLng(loc.lat, loc.lng)
});
})
.each(function (marker) {
marker.setMap(map);
})
.value();
var mc = new MarkerClusterer(map, markers);
var directionsService = new google.maps.DirectionsService(),
directionsDisplay = new google.maps.DirectionsRenderer(),
displayRoute = function () {
directionsService.route({
origin: 'Akin Ogunlewe street VI',//6.512596400000001+','+3.3541297 Pass this in place of the address
destination: 'Falolu road Surulere',//'Falolu road Surulere',//6.4261139+','+3.4363691 Pass this in place of the address
travelMode : google.maps.TravelMode.DRIVING
}, function (response, status) {
if (status === google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
console.log('Directions request failed due to ' + status);
}
});
};
directionsDisplay.setMap(map);
displayRoute();
Is there a way I can pass Latitude
and Longitude
in Origin
and Destination
Instead of physical address (string)?
I tried it but did not work.
I need to pass the numeric (float) value like:6.512596400000001,3.3541297
Instead of Falolu road Surulere
Any help is appreciated thanks