Answer the question
In order to leave comments, you need to log in
Google directions cache route response object
Faced with the task of displaying the path by key markers on a Google map. The Google Maps API v3 provides a convenient means of doing this, and for now the limit of 8+2 markers per path is fine with me.
But the problem is in the second limit, 2500 path calculations for free use per site per day. The point is that you want to calculate the path only in the admin panel, and when displaying the map, the user does not need to pull the Google servers once again, but substitute the deserialized object from the database.
Those. you need to somehow serialize the response object into a function
directionsService.route(request, function(response, status) {
from any example of the Directions section, like this one .
Googling it turned out that complex objects are not so easily serialized, but just in case, I tried a couple of options:
mootools Object-toQueryString
http://www.dotnetfunda.com/articles/article763-serialize-object-in-javascript-.aspx
Serializing Objects in Javascript
Another tricky project
Nothing helps.
As a result, I came across this project, in particular, it says that JSON does not cope well with complex objects and their approach to saving in xml is better, but their library just gives a sinatx error on the line . I
retObj = eval("new "+ nodeType + "()");
checked this way:
I wrote to the creators of the library, I'm waiting for an answer.
And now the question is, maybe someone has already encountered such a problem?
var serializer = new ONEGEEK.GSerializer();
var serializedXML = serializer.serialize(response, 'response');
response = serializer.deserialize( serializedXML );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question