Software Archive
Read-only legacy content
17060 Discussions

google map text directions issues

And_P_
Beginner
636 Views

hello

i use Google maps to display route from origin to destination. I want also show text direction on panel but i have some issues: infact orgin marker is not show and destination marker is placed not correrct as shown in attachment.

My code is

function findRoute() {

var _map = null;

var _seconds = 30;

var _llbounds = null;

var oldLatLng = "";

var boolTripTrack = true;

currentLatitude = 43.83579150;

currentLongitude = 12.74644280;

var mapOptions = {

center: new google.maps.LatLng(currentLatitude, currentLongitude),

zoom: 7,

mapTypeId: google.maps.MapTypeId.ROADMAP,

mapTypeControl: true,

zoomControl: true,

scaleControl: true,

streetViewControl: true

// marker:true

};

_map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);

var directionsService = new google.maps.DirectionsService();

var directionsDisplay = new google.maps.DirectionsRenderer({ 'draggable': true });

$('#dvPanel').html('');

directionsDisplay.setMap(_map);

calcRoute(directionsService, directionsDisplay);

}

function calcRoute(directionsService, directionsDisplay) {

 

var origin1 = new google.maps.LatLng(currentLatitude, currentLongitude);

var destination1 = new google.maps.LatLng(43,18429700, 13,60914200);

var request = {

origin: origin1,

destination: destination1,

travelMode: google.maps.TravelMode.DRIVING

};

directionsService.route(request, function (response, status) {

if (status == google.maps.DirectionsStatus.OK) {

directionsDisplay.setPanel(document.getElementById('dvPanel'));

directionsDisplay.setDirections(response);

}

});

}

someone can help me pls?

thanks

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
636 Views

This is an issue that would be best taken to StackOverflow or the Google forums. We're providing a widget to easily add Google Maps to your app, we're not providing the API and are, therefore, not experts in that API. You'll find experts in those other locations.

0 Kudos
Reply