[SERVER-690] geo bounding box query Created: 02/Mar/10  Updated: 12/Jul/16  Resolved: 17/Mar/10

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 1.3.4

Type: Improvement Priority: Major - P3
Reporter: Eliot Horowitz (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 14
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-772 geo polygon searches Closed
Participants:

 Description   

db.foo.find( { loc : { $within :

{ $box : [ [ 1 , 2 ] , [ 4 , 5] ] }

} } )
db.foo.find( { loc : { $within :

{ $center : [ [ 1 , 2 ] , 6 ] }

} } )



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/Mar/10 ]

$box and $center done see SERVER-772 for polygon

Comment by auto [ 16/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: bounding box $box queries SERVER-690
http://github.com/mongodb/mongo/commit/17825fe4ccb029f5451d8385e64c832711dd19a8

Comment by auto [ 16/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: $center queryies for geo SERVER-690
http://github.com/mongodb/mongo/commit/42820656f3b5ff3570006ba101595d09f54fc8ae

Comment by auto [ 15/Mar/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: some prep for geo $within SERVER-690
http://github.com/mongodb/mongo/commit/3f6d78ca29529446362440c5ae209c40019f8cbe

Comment by Colin Steele [ 10/Mar/10 ]

We (www.hotelicopter.com) would definitely like to see bounding box queries supported. Circle too, but less important. Polygons about the same importance as circle.

Comment by pitchfork media, inc [ 10/Mar/10 ]

either way is fine w/ me, so long as distance can be limited.

Comment by Hubert Lepicki [ 10/Mar/10 ]

> points within 5 miles: db.foo.find( { loc : {$pt: [50, 50], $distance: 5}} )

I think this is equivalent to:
db.foo.find( { loc : { $within :

{ $center : [ [ 50 , 50 ] , 5 ] }

} } )

the only difference is different syntax, and I think original one is superior...

Comment by pitchfork media, inc [ 10/Mar/10 ]

having a "distance" parameter to limit results to those within certain distance would be excellent. i'd love to see polygons, too.

points within 5 miles: db.foo.find( { loc : {$pt: [50, 50], $distance: 5}} )

Comment by Paul Harvey [ 07/Mar/10 ]

Well, even this modest 2d stuff in 1.3.3 makes mongodb even more interesting. $box would be appreciated, but it's probably nowhere near as useful as $center/near. I'm not sure there's much real-world data that can be safely approximated to box areas.

Implementing polygons and validating the work would take a lot of effort, but when you need them, you need them (eg, extract objects which exist in both polygon N and M [intersection]).

Perhaps if you're dealing with data visualisation/reporting stuff $box is okay, but It's unlikely there are many "interesting" data analysis/computational situations in the wild where $box would suffice (but then, are those applications likely to consider mongodb... who knows).

Comment by Eliot Horowitz (Inactive) [ 05/Mar/10 ]

Right, $box is for finding all points within a box, circle is for finding all points within a distance of another point.

Comment by Hubert Lepicki [ 05/Mar/10 ]

This is cool, very cool in fact. But not sure if I understand correctly: $box is for square areas, and $center will perform search within a circle?

Comment by John Hurliman [ 03/Mar/10 ]

I would be interested in bounding box queries. I would choose optimized bounding boxes over generalized polygon queries for my own interest, but either would be good. As long as it has 3D or n-dimensional support.

Comment by Jodi Showers [ 03/Mar/10 ]

Thanks Eliot - Are polygons not a general case for $box?

thus 2 birds (I'm not a math expert)

I especially like the addition of polygons - it's a capability we don't have currently with solr (localsolr) and would make the move to mongoDB much more interesting!

Comment by James Constable [ 03/Mar/10 ]

I'd be especially interested in searching within Polygons. I'm about to embark on a project that uses a lot of geospatial data and was about to use Oracle XE to handle the geospatial calculations I need to do. I'm already going to be using mongo for some stuff so to be able to have that data available there would be brilliant.

Comment by Eliot Horowitz (Inactive) [ 02/Mar/10 ]

polygons are possible - just gauging interest. we really don't like adding features no one wants

Comment by Jodi Showers [ 02/Mar/10 ]

have you considered polygons?

db.foo.find( { loc : { $within :

{ $polygon : [ [ 1 , 2 ] , [3, 4], [5, 6] ] }

} } )

Generated at Thu Feb 08 02:54:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.