Digikam/GSoC2010/ReverseGeocoding
Reverse geocoding will be implemented for the new version of the GPSSync plugin as part of GSOC by Gabriel Voicu, mentored by Michael G. Hansen.
Short description
The idea of reverse geocoding is that when the coordinates on earth of an image are known, the application retrieves the associated human readable location: City, street, country, etc. and stores this information in the image. The location names can be stored in the images as new tags, allowing the user to easily search for all pictures he took in a country, city or even street.
Use Cases
Lets say you are an user who wants to have for every photo the location where it was made. Also, let's say that you have some photos with coordinates inside metadata and some photos without coordinates. All the operations will be made inside Correlator2 Widget(screenshot below).
Now, before you apply the reverse geocoding service, you need to set some parameters. All parameters will be saved in a config file, so if you are happy with your settings, you can set them only once.
Firstly, you need to select the service that will provide your data. The choices are: Google Maps, Open Street Map or Geonames.org. You should try each of them, because they provide different results on some areas.
Secondly, you will have to check the address elements provided by the selected service. If the elements exists in the database of the selected service, you may select: Country, State, County, City, District, Street and Street number.
After you select all this, you should select the language, because you may want to have special characters in the retrieved data.
The tree view from the center of the interface gives you the possibility to select a base tag in your tag tree to let the program know where to put the new resulted "location tags". The location tags will reside on the next level below your selected base tag. For example, if you have:
- myTag1
- myTag2
- myTag3
and you select myTag2 and your photo coordinates are (53.534325,-2.207343), your tag tree will be:
- myTag1
- myTag2
- England
- Manchester
- M60
- Manchester
- England
- myTag3
- myTag2
By default, the base tag will be the root tag from your tag tree.
If you select all your options and you don't want to see them anymore, you can select the "More options/Less options" to hide all the controls listed above. If you select again the button, all these controls will be restored.
In the Correlator2 Widget, when you move a marker on the map, or when you drag-and-drop a photo on the map, coordinates are automatically added/modified. You can check the "Tag automatically when coordinates are changed" checkbox if you want to automatically geotag your photos when their coordinates are changed.
You will also have an option to select where inside you photo metadata will reside the address elements. The options are:IPTC, XMP location and XMP keywords. The default value will include all three already selected, so if you don't know what this acronyms mean, you don't have to worry about them.
After setting all these parameters mentioned above, you can click the button that will automatically geotag your photos. The problem is that there isn't one button, but two buttons. The reason for adding an extra button is that you may want to appy reverse geocoding just for the selected images.
Where is the code?
- gsoc-geocoding: General place for experiments and small code snippets.
- GPSSync2: New version of the GPSSync plugin.
- WorldMapWidget2: Widget to display the location of images on both Google Maps and Marble. Required by GPSSync2.
Backends
Google Maps
- provides both reverse geocoding and elevation information
- for a given coordinate, returns the next address elements if they exist:
- country
- state
- county
- city
- district
- street
- street number
OpenStreetMap Nominatim
- Marble already has integration for this service
- Address elements returned, if they exist:
- country
- state
- state district
- county
- city
- city district
- street
Geonames.org
- provides both reverse geocoding and elevation information
- returned address elements if they exist:
- country
- state
- county
- city
- a list of nearby streets for non-USA
- nearest street for USA only
- distance from the the given coordinate to returned address
Storing information
The textual location descriptions can be stored as tags and in the dedicated location fields provided by XMP and IPTC. However, there are some competing tags which store the same information.