On Sep 11, 6:10 pm, Hasan <[email protected]> wrote: > So I've solved this problem. Posting a solution for posterity. > > To create the map, I had created a LatLngBounds for the city area that > I was interested in. When the route had to be drawn, it was falling > out of the bounds, and was thus throwing up an error. By removing the > 'fitBounds' property, everything is hunky dory once again!
And how were we supposed to know that given the information you provided? A link to your map (as requested in the posting guidelines would have potentially allowed someone to help you). But glad you fixed it. -- Larry > > On Sep 12, 12:51 am, "[email protected]" <[email protected]> > wrote: > > > > > > > > > On Sep 11, 3:28 pm, Hasan <[email protected]> wrote: > > > > Hey, > > > > I'm working off a localserver so can't point to a link. > > > I can't fix that. > > > > The rest of my > > > code works just fine. It's only this portion that is acting off. In > > > fact, the only error is that the route is not being drawn. Even though > > > the route is being successfully retrieved and the setMap() is working > > > fine. > > > > The JS error is this: (in my console, using Firebug) > > > > d[tc] is not a function > > > [Break On This Error] (81 out of range 44) > > > You have the debugger. What part of your code is calling that? Any > > suspicious undefined variables at that point? > > You need to investigate your code, you didn't give us enough context > > to do that. > > > -- Larry > > > > My code is kinda large and unweidly. I'm a little embarrassed to show > > > it off in its entirety. > > > > On Sep 11, 10:14 pm, "[email protected]" <[email protected]> > > > wrote: > > > > > On Sep 11, 9:39 am, Hasan <[email protected]> wrote: > > > > > > Hey, > > > > > > I'm using the Directionsservice class to get the routes and then > > > > > trying to display them using the directionsrenderer. However, I get a > > > > > weird error like so: > > > > > > d[tc] is not a function > > > > > [Break On This Error] (81 out of range 43) > > > > > main.js (line 81) > > > > > > I really haven't been able to figure it out. I'm checking to see and > > > > > everything else works. I can see the result of the call to > > > > > directionsservice. When I call getMap() on directionsrenderer, I can > > > > > see the map and a property of the map object called "directions". > > > > > > But the route just won't display! > > > > > What javascript errors do you get? > > > > > Where is the link to your map that exhibits the problem? > > > > >http://groups.google.com/group/google-maps-js-api-v3/browse_frm/threa... > > > > > -- Larry > > > > > > Any help is appreciated. > > > > > > --- > > > > > > CODE: > > > > > > function draw_route() { > > > > > directions_service = new > > > > > google.maps.DirectionsService(); > > > > > directions_display = new > > > > > google.maps.DirectionsRenderer({ > > > > > draggable : true > > > > > }); > > > > > > directions_display.setMap(map); > > > > > //defined earlier > > > > > > directions_service.route({ > > > > > origin : from_marker.position, > > > > > destination : > > > > > to_marker.position, > > > > > travelMode : > > > > > google.maps.TravelMode.DRIVING > > > > > }, function(result, status) { > > > > > > if(status == > > > > > google.maps.DirectionsStatus.OK) { > > > > > console.log(result); > > > > > //shows the correct array > > > > > > > > > > directions_display.setDirections(result); //does not work :( > > > > > } else { > > > > > console.log("error " > > > > > + status); > > > > > } > > > > > }); > > > > > } -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
