Using a spatial database to find polygons that contain a point
-
07-06-2021 - |
Question
I'm using MongoDB to store spatial records. Some records are polygons, and others are points. Data is being continually inserted.
I need to be able to access all records whose polygon contains a point. Mongo's spatial queries allow finding all points within a polygon, but not all polygons that contain a point. Is there a good way to do this in MongoDB another database system?
Solution
Unfortunately, there is no way to run this query at present -- unless you're willing to simplify the application (i.e., assume all polygons are circles of a particular radius [or small set of radii]).
There's an open ticket for the functionality you described: https://jira.mongodb.org/browse/SERVER-2874
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow