Stewart,
I'm trying to do exactly what you were, re-hydrating the reponse from my 
database.  Unfortunately, when I'm fixing my JSON object with LatLng and 
BoundLatLng objects, it's not working for me.  I'm able re-hydrate the plain 
JSON object but my "fix" routine must not be doing a good job of fixing 
everything because on my map, it doesn't result in a purple line on my map 
showing the route like the original object does.

Here's my code, any suggestions?

function FixDirectionResult(rslt) {
    for(r=0; r<rslt.routes.length; r++) {
        var route = rslt.routes[r];
        var bounds = route.bounds;
        route.bounds = new google.maps.LatLngBounds(
            new google.maps.LatLng(bounds.U.b,bounds.O.d), 
            new google.maps.LatLng(bounds.U.d,bounds.O.b));
        
        for(l=0; l<route.legs.length;l++) {
            var leg = route.legs[l];
            leg.start_location = new 
google.maps.LatLng(leg.start_location.wa,leg.start_location.ya);
            leg.end_location = new 
google.maps.LatLng(leg.end_location.wa,leg.end_location.ya);
            
            for(s=0; s<leg.steps.length;s++) {
                var step = leg.steps[s];
                step.start_location = 
                    new 
google.maps.LatLng(step.start_location.wa,step.start_location.ya);
                step.end_location = 
                    new 
google.maps.LatLng(step.end_location.wa,step.end_location.ya);
                
                for(p=0;p<step.path.length;p++) {
                    var path=step.path[p];
                    step.path[p] = new 
google.maps.LatLng(step.path.wa,step.path.ya);
                }
            }
        }
        
        for(o=0; o<route.overview_path.length;o++) {
            var overview = route.overview_path[o];
            route.overview_path[o] = new 
google.maps.LatLng(overview.wa,overview.ya);
        }
    }
} 

-- 
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 google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to