[SERVER-2874] Support for "point in polygon" and "polygon intersects polygon" queries Created: 30/Mar/11  Updated: 12/Jul/16  Resolved: 19/Dec/12

Status: Closed
Project: Core Server
Component/s: Geo, Querying
Affects Version/s: None
Fix Version/s: 2.3.2

Type: New Feature Priority: Major - P3
Reporter: Shaun Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 46
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to DOCS-641 Document new spherical 2d geo functio... Closed
is related to SERVER-1760 Support geo searches across the anti-... Closed
Participants:

 Description   

MongoDB should support searching for all polygons containing a particular point where the polygons are stored in records and the point is specified in the query. Similarly, MongoDB should also support searching for all polygons that intersect a polygon.

NOTE: This is the inverse of http://jira.mongodb.org/browse/SERVER-772



 Comments   
Comment by auto [ 06/Dec/12 ]

Author:

{u'date': u'2012-12-05T19:38:09Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-2874 parse old format geo data
Branch: master
https://github.com/mongodb/mongo/commit/8a01771e20998a90e52aba7b0a52759d36b5f4f1

Comment by auto [ 13/Nov/12 ]

Author:

{u'date': u'2012-11-09T18:24:25Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-2874 performance fix for s2 intersect, add s2 near
Branch: master
https://github.com/mongodb/mongo/commit/eaa493c99d33cf14e6c9bd391629a624a6368a10

Comment by auto [ 05/Nov/12 ]

Author:

{u'date': u'2012-11-02T14:31:42Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-2874 add s2 indexing and cursor
Branch: master
https://github.com/mongodb/mongo/commit/b500d17c347044b6d38c135c7edc142e3ac68658

Comment by auto [ 01/Nov/12 ]

Author:

{u'date': u'2012-10-30T16:08:38Z', u'email': u'hk@Harishabds-MacBook-Pro.local', u'name': u'Harishabd Khalsa'}

Message: SERVER-2874 fix geojson patch w/o chmod
Branch: master
https://github.com/mongodb/mongo/commit/c445505b7ff191236103558eb7b43e4f1305399b

Comment by auto [ 29/Oct/12 ]

Author:

{u'date': u'2012-10-24T14:40:42-07:00', u'name': u'Hari Khalsa', u'email': u'hkhalsa@10gen.com'}

Message: SERVER-2874 Import S2 the flags library it depends on, add GeoJSON parsing
SERVER-2874 make the S2 stuff compile on mac/windows
Branch: master
https://github.com/mongodb/mongo/commit/325b42be26c6dda8965f2d6b9b7b64b381f5bd61

Comment by auto [ 29/Oct/12 ]

Author:

{u'date': u'2012-10-24T14:40:42-07:00', u'name': u'Hari Khalsa', u'email': u'hkhalsa@10gen.com'}

Message: SERVER-2874 Import S2 the flags library it depends on, add GeoJSON parsing
SERVER-2874 make the S2 stuff compile on mac/windows
Branch: master
https://github.com/mongodb/mongo/commit/325b42be26c6dda8965f2d6b9b7b64b381f5bd61

Comment by David [ 23/Aug/12 ]

Really important for me. I've got a set of regions and I want to know which region is one GPS point... Really limits my action on this...

Comment by Shaun York [ 15/Aug/12 ]

This would be a great improvement to the spatial offering in MongoDB already.

Another example use case for this:

  • find the neighborhood (polygon) of a given residential property (point)
Comment by Deval Chauhan [ 10/Aug/12 ]

A box intersecting with another box may not be the ideal solution, but a good way to start.

Comment by Konstantin Ignatyev [ 09/Aug/12 ]

Important for me too!
Can we start with just implementing support for finding if one box intersects with another?

Comment by Travis Webb [ 31/Jul/12 ]

+1 important feature. Looking for a PostGIS replacement, but can't use Mongo without this.

Comment by Jigar Shah [ 28/May/12 ]

This is really important feature. Like where user has several regions - stores (polygons). And want to find a point (a person) is in which polygon or near or in boundary of any polygon.

Comment by Morten Haraldsen [ 27/Mar/12 ]

Use case:
A user took a photo tagged with GPS coordinates. Subscribers have defined one or more areas of interest (polygons), and if any image is published within that/those areas, a notification should be sent.

Comment by Justin Palmer [ 31/Aug/11 ]

I'll present two use cases for this.

  • Find all census blocks contained in a census tract (polygon containing polygon query)
  • Find census block, tract and neighborhood in which a crime happened (polygon containing point query).
Comment by Eliot Horowitz (Inactive) [ 31/Mar/11 ]

I merged because I think they're probably going to be implemented in very similar ways, but might be different to warrant 2 cases.
Will open for now

Comment by Shaun [ 31/Mar/11 ]

I specifically called out SERVER-772 in my feature request as being the inverse of what I was requesting. Unless 772 is incomplete in its description or in the scope of work being performed to address it - 772 is clearly regarding finding all individual points within a bounding polygon.

My request is for the ability to find all polygons that overlap polygons and/or all polygons that contain a specific point. Why was my request merged in to 772?

Comment by Eliot Horowitz (Inactive) [ 31/Mar/11 ]

See SERVER-772

Comment by Shaun [ 30/Mar/11 ]

Oracle has good details on how they implement their spatial indexes at:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/sdo_intro.htm
http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96630/sdo_intro.htm

Note that the 1st link is from 10g while 2nd link is from 9.2. Oracle removed quadtree indexing details from the 10g docs (because they improved r-tree indexes in 10g), but I thought it was relevant here since quadtree is closer to the geohash mechanism used in MongoDB. The full r9 doc is at
http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88805.pdf
and the full 10g doc, including quadtree details, is at
http://download.oracle.com/docs/cd/B12037_01/appdev.101/b10826.pdf

Generated at Thu Feb 08 03:01:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.