Revision 806827

Go back to digest for 18th May 2008

Features in Graphics

Marcel Wiesweg committed changes in /trunk/extragear/graphics/digikam/libs/database:

Add support for searching the database by GPS position.
You can specify a position by coordinates, and find all images located around that position within a specified distance.

The search is based on two parts.
Part 1: We compute a (false) "spherical rectangle" where the left and right side are longitude (thus Great circles), and the top and bottom are latitudes (no Great circles). This allows, by simple and fast comparison, to sort out the candidates of our search.
Part 2: We use the Haversine formula to compute the exact distance.
This formula assumes the earth is a Sphere, and it's only the second best, but much faster assumption for such a computation.

Part 1 is done in SQL, Part 2 by a post hook on the returned result set in C++.
The ImageQueryBuilder can now return a list of post hooks and ImageLister checks the hooks for each result.

Writing a position search can look like this:

writer.writeField("position", SearchXml::Near);
writer.writeAttribute("type", "radius");
writer.writeAttribute("distance", QString::number(100));
writer.writeValue(QList<double>() << -23.029 << 65.9786725);

Which search all images 100m around a certain point in Northwestern Iceland.

File Changes

Modified 2 files
  • /trunk/extragear/graphics/digikam/libs/database
  •   /imagequerybuilder.cpp
  •   /imagequerybuilder.h
2 files changed in total