0

I will be using mongodb database which supports data on an Euclidean plane (not spherical). I will be performing queries which return all points within a box.

For the box I need to specify the upper left and bottom right coordinates (http://docs.mongodb.org/manual/reference/operator/query/box/#op._S_box).

My question is based on an a lat/long coordinate as input, how can I create these two coordinates needed?

I want to take my coordiante and create a box of roughly ~1km (I understand since it is a box it will not be 1km in all directions, but I am not looking for perfect accuracy).

Is there an algorithm for this?

  • May I ask why you need to use bbox query? BBox searching would general be utilised when you already have the bottom left and upper right coordinates available to you, i.e. a box has been drawn. Constructing a box around a centre point using lat/long coordinates is non trivial with Mongodb in comparison to the other proximity queries offered (e.g. near). – Guy Jun 8 '15 at 11:00
  • what other languages/frameworks are you using other than Mongodb? – Guy Jun 8 '15 at 11:22
  • I am also using Java. – user2924127 Jun 8 '15 at 13:53
  • do you have any further background to your requirement? – Guy Jun 9 '15 at 9:20
  • @Guy I am essentially getting a geolocation input in my java servlet. Once I have the location I need to calculate the bounding box corners and attach them to my boubsing box query and send that query to mongodb. – user2924127 Jun 9 '15 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.