PDA

View Full Version : Directions on Ext.Map not showing



peterkuli
20 Feb 2011, 10:29 AM
I want to show driving directions on a map. When I call setDirections (Google API), the route is not showing up. I'm getting no errors, so I think it has something to do with updating the map...


Ext.Msg.prompt('Get directions', 'Startaddress:', function(btn, text){
var start = text;
var end = "Some address";
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
});

(Yes, I declared directionsDisplay and directionsService)

I already tried to call map.show() , tabPanel.update() and some other options, but didn't work...

I declared the directionsdisplay as follows:
directionsDisplay.setMap(map.map);

alanr1
13 Apr 2011, 2:33 PM
I was able to get this to work using code very similar to what you've provided. Are you getting any errors in browser console, etc.? I find the google chrome debugger is a must...

Also, you need to make sure that the map is rendered before you try to display directions on it. There is a maprender event from ext.map.

Good luck

ChuK0i
14 Apr 2011, 5:30 PM
How did you get this to work? I am also having problems rendering directions on a map in Sencha.

jameshenderson
21 Jul 2011, 4:04 AM
I am having the same problem and there no example code anywhere. Does anyone have a working example of Google Directions with Sencha please?

rondkop
23 Aug 2011, 6:42 PM
I ended up having to do the "directionsDisplay.setMap(map.map);" right before the directionService.route call.

Prior to now, I had it somewhere else...but once I moved it down there (by luck), my directions popped up.

Hope that helps.

Sasha172
14 Sep 2011, 3:35 AM
Hey,

Im new to this whole Sencha-Google thing....

Can any of you post the code (with the declarations and everything) here ??

I currently have one mapPanel with a button in the toolbar that needs to find/show the directions onClick.

Thanks :)