Geotagging: not single cards

    On the Internet, the reception of a map of the place where the photo was taken is already quite widespread. In practice, this is implemented in two ways:
    1. Just by indicating the location on the map, for example, how it is done on Flickr or using the GeoPress plugin for Wordpress
    2. Extracting coordinates from EXIF'a photos - if they are there
    The second way, of course, is much more “prettier” and more correct - but a bit more complicated technically. However, I will not consider how to add coordinates to EXIF ​​- but I will talk about how they can be used.
    For a long time, a very long time, the idea tormented me - I do not want to show the map. That is, the map is good, but not all. I want to tell the visitor in human language: the photograph was taken in such and such a city at such and such an address. Well, for a very long time I wanted to do this, and in the end I got ready.

    Of course, as my “experimental pig” I took my own photo blog - hacking, so complete. A little about how it is organized:
    1. At the very bottom of the hierarchy is (well, it doesn't!) Wordpress 2.7
    2. Yet Another Photoblog plugin is based on this Wordpress , which turns the blog into a real photo blog.
    3. But on YAPB, in turn, the Reflection theme is spinning , globally finalized with a file (almost beyond recognition)
    Among the advantages that YAPB gives, one of the most important for developers is that exactly one picture is always associated with the post, and you can easily get it EXIF. Therefore, everything else was a matter of technology.

    I wrote a plug-in for YAPB (yes, a plug-in for a plug-in) that took coordinates (which for some reason are written in degrees-minutes-seconds in EXIF), converted them to WGS84, and then transferred everything to a client who did everything the rest (using JavaScript, respectively). Why is it so hard? First of all, because the Google Maps API is ultimately used, and this has to be done on the client. Actually, each page generates two API calls - one for generating a map, and the other for reverse geocoding of coordinates. Actually, the result of this reverse geocoding is displayed as an address. You can see how it all looks live, for example, here or here. It is important to note that if there are no coordinates in the photo - magic will not work, there will be no map and the address will not appear - so loading the photo is always preceded by the process of putting the coordinates on them (however, it is extremely automated); in addition, the address is determined with the accuracy that is available to the Google geodata provider (that is, if the photo was taken in an open steppe a hundred kilometers from the nearest settlement, a miracle will not happen, and at best you will get the name of the road ).

    In principle, I am absolutely ready to share all these developments, but ... the code is so terrible that I am just ashamed to post it. Perhaps after some time I will comb it and arrange it in the form of a normal plug-in - if there is interest in this. Then take my leave - and successful frames to you!

    Also popular now: