Announcement Announcement Module
Collapse
No announcement yet.
Geo Query with "Point" object on Spring Data Mongodb Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Geo Query with "Point" object on Spring Data Mongodb

    Hi all,

    i use Spring Data Mongodb 1.0.1 RELEASE.
    When i use geoQuery with maxDistance, i get incorrect result.
    Example of the query :
    Code:
    Query.query(Criteria.where(("location").nearSphere(city.location).maxDistance(new Distance(50, Metrics.KILOMETERS).getNormalizedValue()))
    where "city.location" is org.springframework.data.mongodb.core.geo.Point object.

    I guess the problem comes from Point object. With Point object the mongo query is written with the (latitude, longitude) order, though with mongoDB, you need to write the query with the (longitude, latitude) order.
    (see http://www.mongodb.org/display/DOCS/...butMapsareFlat)

    Is there something to do with the Point coord order ? ATM, i need to create another object "mongoPoint" with switched values of "Point" to make query works. Am i wrong ?

    Thx to all of Springsource team !
Working...
X