Google Maps to Panoramio user script

March 3 update:

The map object volunteered by the Google maps site of today only offers the pan() method with intact name, hence this script, needing all of getCenter(), getZoom(), getMapTypes() and getCurrentMapType() to work, no longer functions.

If you are familiar with the Google Maps API or sites using it, you might know that the Google logo in the bottom left corner of every view is a clickable link that brings up the same view you were seeing, but in Google Maps (or, actually, Google Local, but for most purposes the result is the same). A rather good feature, and especially so in times such as the present, when Google Local has two zoom levels more than all the sites using the Google Maps API.

The feature skew comes from the Google Maps team recently having pushed out new maps images to Google Local previously only available in Google Earth. I would presume we will eventually get to see these via the Maps API too, quite likely with the event of the forthcoming move to Maps API version 2.

Especially as the new API names zoom levels with 0 mapping to "see the whole world in one tile", which was previously "see the finest detail map imagery available". Clearly, the new world order will allow for future expansion a bit more safely.

Anyway, while I like the "zoom to Local" feature, I kind of lack a "zoom back to Panoramio" link in the other direction, and now I wrote myself one. Panoramio, if you haven't seen it before, is a very well designed huge worldwide photo album by Joaquín Cuenca Abela, who also keeps a good blog on his tampering with javascript and tools for the purpose. And you guessed it; it runs atop Google Maps.

A bit to my surprise, my script ended up number one at userscripts.org. (Have you started reusing the ID:s of deleted scripts, Jesse et al?) Just in case it's a temporary lapse and the above doesn't end up the script's permalink, you may pick it up at my own userscript repository too. That actually goes for most, not to say all, of my user scripts. If either archive is offline, try the other for a fallback.

When you have installed it, you will get a little "Panoramio" link sitting at the top right of your Google Maps / Google Local page, right next to the Help link. Until the Google people change layouts, or the javascript code running in the page to generate the maps changes incompatibly, both of which might not happen in a rather long time, I'd venture guessing.

At least I didn't fall into the trap of picking up any of the names of the crunched-into-randomness method and property names the Maps and other Google javascript code is otherwise famous for. Feel free to read the code; it's short, and contains a few useful ideas and techniques for Greasemonkey and user script authors.
blog comments powered by Disqus