I am using google maps to find lat and lng of the clicked location. After stringifying the javascript event object, I found
{"latLng":{"Za":25.800813110356653,"$a":78.7055234375},"pixel":{"x":689,"y":336},"va":{"x":183.96837222222223,"y":108.99927181860028}}
So Za is lat and $a is lng now.
Though two days ago, I was using exact same code and getting the same object as:
{"latLng":{"Ya":25.800813110356653,"Za":78.7055234375},"pixel":{"x":689,"y":336},"va":{"x":183.96837222222223,"y":108.99927181860028}}
What bothers me is that they have changed the object names overnight. Why do they do this and is there any reliable way to find latitude and longitude instead?
I am using google maps to find lat and lng of the clicked location. After stringifying the javascript event object, I found
{"latLng":{"Za":25.800813110356653,"$a":78.7055234375},"pixel":{"x":689,"y":336},"va":{"x":183.96837222222223,"y":108.99927181860028}}
So Za is lat and $a is lng now.
Though two days ago, I was using exact same code and getting the same object as:
{"latLng":{"Ya":25.800813110356653,"Za":78.7055234375},"pixel":{"x":689,"y":336},"va":{"x":183.96837222222223,"y":108.99927181860028}}
What bothers me is that they have changed the object names overnight. Why do they do this and is there any reliable way to find latitude and longitude instead?
Share Improve this question asked Apr 18, 2012 at 13:51 mihsathemihsathe 9,15412 gold badges42 silver badges55 bronze badges3 Answers
Reset to default 12Internal names will change with code changes: if another token is introduced then a variable which was minifed as Ya
may end up being Za
.
You should never access internal references. Always use documented methods.
Ok. I have found the answer partially.
We do not need to bother the names. We can use functions instead.
lat = e.latLng.lat();
lon = e.latLng.lng();
Google doesn't change the names of the published methods. However, whenever an update is deployed the maps script file is run through an obfuscation process that reduces the familiar names in the code to the short names you are trying to reference. The results can be different every time the code is obfuscated. As Andrew points out above, if a new method or variable is introduced, that can throw off the previous obfuscation order. (they may even run this process periodically just to prevent people from accessing the internal members like you were doing above).
http://en.wikipedia/wiki/Obfuscation_%28software%29