I have an app that saves google map markers, I basically save the lat lng coordinates/vriables in an array, then I save it in my mongodb. When I reload those markers, I loop in the array and create markers from the saved lat lng variable.
My problem is that when I saved my markers the first time, a lat was called Pa and a lng Oa, then 1 month ago, I save markers, and then try to load them, but my loop doesn’t recognize the lat lng variables, they were changed to Sa, Ta. So I changed my client code to pull variables of Sa, Ta instead, no big deal.
Today, I save another array of marker, try to load it, and it doesn’t work, again their native google api variable name are changed to lat Ua and lng Va … My client code doesn’t work for any new saved marker.
I’m obviously not saving markers the “google” way, what am I doing wrong?
Thank you
You should not rely on the variable names of minimized code. Call them “lat” and “lon” or something like that. The internal names such as
Paare potentially lost on each recompilation. In particular, they will likely change when Google fixes a bug or releases a new version of the API.So don’t just blindly encode the marker objects. Convert them to a stable representation that you control yourself (and not the automatic code compiler of Google maintains and changes at will).