Latitude Longitude order

20 views
Skip to first unread message

Ugo Bataillard

unread,
Feb 26, 2013, 1:08:57 AM2/26/13
to rogue...@googlegroups.com
Hello everyone,

I was wondering about switching to Rogue but I notice a problem with the geo search.

You are using a LatLong case class that specifies lat before long and the doc specifically says:
All documents must store location data in the same order. If you use latitude and longitude as your coordinate system, always store longitude first.

As all your geo queries depend on this class and that all the prototypes specify lat before long, it's not really easy to work around this issue.

Is there any way to solve this ?

Ugo

Jason Liszka

unread,
Feb 26, 2013, 11:09:06 AM2/26/13
to rogue...@googlegroups.com
Sorry about that, I think rogue was written before mongo supported spherical geometry. Actually rogue doesn't have support for $nearSphere at all yet. It would be pretty straightforward to add, along with a LongLat case class and a GeoQueryField2 that supported the correct order, and an implicit conversion to convert a LongLat field to a GeoQueryField2.

I can probably add that this weekend, but you could also do it in your own codebase, outside of rogue. Just make sure the implicit conversion is in scope alongside the rogue implicits.



Ugo

--
You received this message because you are subscribed to the Google Groups "rogue-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rogue-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ugo Bataillard

unread,
Feb 27, 2013, 7:51:16 PM2/27/13
to rogue...@googlegroups.com
Thank you for the answer, I could definitely do that but then I need to duplicate 5 of your methods.

I didn't go for Rogue yet but in my solution I kept a LatLong object in my code since
I much prefer LatLong for integration for other services and my mind's sanity, I just changed the serialization order in asDBObject in a custom location field,  and made sure that I wrapped all methods to only use the LatLong object as argument and never the coordinates directly.

Cheers,

Ugo



--
You received this message because you are subscribed to a topic in the Google Groups "rogue-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rogue-users/tR6j4UA8aHA/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to rogue-users...@googlegroups.com.

Jason Liszka

unread,
Feb 28, 2013, 10:47:43 AM2/28/13
to rogue...@googlegroups.com
Yeah, I would duplicate those methods anyway, but fwiw the argument types would be different. That's pretty common in QueryField.scala, since it's kind of an adapter layer between the desired query syntax and the underlying representation.

I'll add LongLat this weekend because I do want to have support for $nearSphere.
Reply all
Reply to author
Forward
0 new messages