-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Two questions about geospatial data and OGM
PostPosted: Tue Oct 31, 2017 10:40 am 
Newbie

Joined: Mon Mar 20, 2017 7:40 am
Posts: 6
Hello,

I have two questions:

First question:

Is there a way to define a geospatial index (https://docs.mongodb.com/manual/geospat ... al-indexes) as it is done with full text indices (https://docs.jboss.org/hibernate/stable ... xt_indexes)?

Second questions:

Geospatial queries need coordinates to be persisted in a defined order.

MongoDB Docs (https://docs.mongodb.com/manual/geospat ... atial-data):

Quote:
Specify via an embedded document:
[...]
If specifying latitude and longitude coordinates, the first field, regardless of the field name, must contains the longitude value and the second field, the latitude value ; i.e.

<field>: { <field1>: <longitude>, <field2>: <latitude> }


I use the the following:
Code:
@Embeddable
public class LngLat implements Serializable {

    private Double lng;

    private Double lat;

    public LngLat() {
    }

    public LngLat(Double lng, Double lat) {
        this.lng = lng;
        this.lat = lat;
    }

    public Double getLng() {
        return lng;
    }

    public void setLng(Double lng) {
        this.lng = lng;
    }

    public Double getLat() {
        return lat;
    }

    public void setLat(Double lat) {
        this.lat = lat;
    }
}


...but it gets persisted like this:

Code:
{ ..., "location" : { "lat" : 48.2088284029927, "lng" : 16.359914169215926 }, ...}


...the other way round.

Is there a way to define the order?

Thanks,

Paul


Top
 Profile  
 
 Post subject: Re: Two questions about geospatial data and OGM
PostPosted: Fri Nov 03, 2017 5:43 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
I don't think there is an easy way to solve this issue.
You probably need to create a new type descriptor, and use it via the org.hibernate.boot.model.TypeContributor

I'll try to write an example over the week-end.
In the meanwhile you can try have a look at the Hibernate OGM source code: https://github.com/hibernate/hibernate- ... butor.java

Thanks,
Daivde


Top
 Profile  
 
 Post subject: Re: Two questions about geospatial data and OGM
PostPosted: Fri Nov 03, 2017 5:50 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
By the way, Thanks for the feedback.
I've created a JIRA: https://hibernate.atlassian.net/browse/OGM-1339


Top
 Profile  
 
 Post subject: Re: Two questions about geospatial data and OGM
PostPosted: Tue Nov 28, 2017 10:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Jan 05, 2017 6:04 am
Posts: 13
We made some good progress in https://hibernate.atlassian.net/browse/OGM-1339 and the Geospatial support will be part of the next version of OGM.


Top
 Profile  
 
 Post subject: Re: Two questions about geospatial data and OGM
PostPosted: Tue Nov 28, 2017 5:38 pm 
Newbie

Joined: Mon Mar 20, 2017 7:40 am
Posts: 6
Cool, thanks for the answers and the update!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.