On Aug 30, 6:44 pm, Stewart <[email protected]> wrote: > On Aug 31, 3:13 am, "[email protected]" <[email protected]> > wrote: > > > On Aug 30, 12:33 am, Stewart <[email protected]> wrote: > > > > Hi All - > > > > I'm building a webapp where I want to store a stringified > > > DirectionsResult into my DB, and then pull it out later on and show it > > > on a map at a later time. > > > Why not get it when you need it? > > The app needs to be able to get a route (from a DirectionsService) and > then show that same route every time (days, weeks, months later). If I > request a new DirectionsResult every time then I can potentially get a > different route each time. > > > > > > I've got a sample application > > > here:http://bolidian.com/samples/gmapi/test.html > > > > As you can guess, it's not working. :-/ > > > > When I first use a DirectionsService to get the DirectionsResult and > > > pass it to a DirectionsRenderer then, it works fine. I then stringify > > > the DirectionsResult and put in my DB, then pull it out, destring it > > > (using json2.js) and call setDirections on a DirectionsRenderer: no > > > response. The DirectionsRenderer doesn't show anything. > > > > My javascript console shows this error: > > > > Error: b[Kb] is not a function > > > Source File:http://maps.gstatic.com/intl/en_us/mapfiles/api-3/2/2/main.js > > > Line: 85 > > > > I don't understand what this error means or why it's there -- and that > > > JS code is heavily minified so I can't really understand it. > > > > Note that I've carefully compared the DirectionsResult going into and > > > out of the DB, and they're identical char-by-char. > > > Not anymore. When I do the same directions query, the "internal" > > names the API uses are different (there must have been a release since > > you captured your sample). Since the json object contains these > > internal names, I have to assume that this is not something that is > > intended to be done, you will certainly have to lock down the version > > of the API for it to continue working (since you don't specify the > > verison in the script include, you are currently getting the > > development version, I think..). > > It can't be a different version of the API -- I did all this in the > space of about 3 hours yesterday. Same results today. > > > I also see character encoding problems in your version (? instead of > > the copyright symbol). > > I don't see that -- where are you seeing it?
I compared the stringified json object you display with the one I got from the same directions query earlier today. > > > I wouldn't think this kind of use would be allowed by the Terms of > > Use, but you are displaying it on a map, so it may be OK (and IANAL), > > it certainly seems to not be anticipated. > > I didn't see anything in the conditions that said it's not okay to > store the DirectionsResult for later use. I can't see why it would be > a problem -- ultimately it means less calls on the DirectionsService, > which is a good thing, right? (Though that's not why I'm doing it -- I > actually need the same set of directions for a long period of time > [see above]). I can't answer the questions about the legality, that you will have to decide for yourself or consult a lawyer about. Regardless of that, the json object contains internal names from the particular API version, so you will need to specify a version, and change your code whenever that version becomes obsolete. -- Larry > > Stewart -- 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.
