[hibernate-dev] Coordinates storage in Lucene index for spatial functionality

Sanne Grinovero sanne at hibernate.org
Thu May 3 05:43:25 EDT 2012


Correct.

On 3 May 2012 10:07, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
> Let me see if I understood by rephrasing. I am trying to get a feel of where conversions happen.
>
> I am assuming that this is mostly relevant for the boolean query approach and the later circle memory filtering (ie that quad tree is not involved).
>
> Today we accept decimal coordinates from the user and store them as is in the index. But to calculate the right rectangle and then circle filter when
> we build a query and later filter elements in memory (circle):
>
> - we convert the query coordinates into radians to find the right box boundaries coordinates and convert them back into decimals
> - for each matching element in the box we further convert the coordinates in radian to filter by circle
>
> In the new scheme where radians are stored, we would:
>
> - receive coordinates from the user as decimals
> - convert them to radians once at indexing time and once at query time
>
> So the big difference would be that we avoid the per element in the box filtering conversion from decimals to radians.
>
> Am I correct or completely wrong?
>
> On 3 mai 2012, at 10:12, Nicolas Helleringer wrote:
>
>> Hi all,
>>
>> Sanne and I have been wondering about the way the spatial
>> branch/module/functionality for Hibernate Search shall store its
>> coordinates in the Lucene index.
>>
>> Today it is implemented with decimal degree for :
>> - easy debugging/readability
>> - ease of conversion on storage as we want to accept mainly decimal degree
>> from users data
>>
>> Sanne pointed out that when the search is done there is quite a few
>> conversion to radians for distance calculation and suggested that we may
>> store directly coordinates under their radians form.
>>
>> I have tried a patch to implement this and as I was coding it I feel that
>> the code was less readable, in the coordinates normalisation mainly and
>> that there was as many conversion as before.
>> Conversions had moved from search to import / export of coordinates in and
>> out the spatial module scope to user scope.
>>
>> What the docs does not tell (yet), is that we are waiting for WGS 84 (this
>> is a coordinate system) decimal degree coordinates input, as these are
>> quite a de facto standard (GPS output this way).
>>
>> Today this is not the purpose of Hibernate Search spatial initiative to
>> handle projections. There are opensource libs to handle that on user side
>> very well (Proj4j)
>>
>> So. The question is : shall we store as radians or decimal degree ?
>>
>> Niko
>>
>> P.S : Hope it is clear. If not ask for more.
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list