[Xapian-tickets] [Xapian] #481: Merge geospatial branch
Xapian
nobody at xapian.org
Sun Aug 14 21:15:44 BST 2011
#481: Merge geospatial branch
-------------------------+--------------------------------------------------
Reporter: richard | Owner: richard
Type: enhancement | Status: assigned
Priority: highest | Milestone: 1.3.0
Component: Library API | Version: SVN trunk
Severity: normal | Keywords:
Blockedby: | Platform: All
Blocking: |
-------------------------+--------------------------------------------------
Comment(by richard):
The special cases are fragile, as implemented; I think that something at
latitude -89.999999999 will be rounded to having latitude -90, but not
trigger the special case (so the longitude will be stored, too). This
should be easy to fix.
In performance testing, I noticed that a significant part of the time
taken by geo_decode (around 30%) is doing the string comparison for "if
(value == "\xff\xff")". It occurs to me that it might be better not to
have the special short representations of -90 and +90: instead, always use
6 bytes for the representation. This has the advantage that multiple
values could be stored in the slot with no need to mark terminators; and
that when encoding multiple values, a 6 byte fixed buffer could be used,
instead of a string (which would probably be faster). We could also just
do the special case handling at encoding time, checking the integer
representation of the number of 16ths of a second in the latitude, and
setting the longitude to zero if that is the value for -90 or +90.
It also occurs to me that it might be better to store longitude values as
more significant that latitude. With the current code, a range query on
the encoded values can be used to check if the coordinate is in a given
degree range of latitude values, but I suspect being able to do a quick
range query to check a range of longitudes would be more useful in many
cases; for example, it would enable US and european coordinates to be
distinguished quickly; there is probably a greater range of longitude
degree values in use than latitudes.
--
Ticket URL: <http://trac.xapian.org/ticket/481#comment:22>
Xapian <http://xapian.org/>
Xapian
More information about the Xapian-tickets
mailing list