Before asking this question I read these answers, but could not find the solution:
Check if coordinate is within area
Geolocation - Check if a location belongs to an area
Check if coordinate in selected area
How to calculate intercepting area of polygons in python
I have to check if a given area, for example:
[
[
[61.21079236, 41.892769716],
[61.2107934860001, 41.892589705],
[61.2104923360001, 41.8925886540001],
[61.2104912090001, 41.8927686640001],
[61.21079236, 41.892769716]
]
]
intercepts with any of other provided areas. Chosen area can be in any shape, square, polygon, triangle etc.
[
[ // area 1
[
[61.21079236, 41.892769716],
[61.2107934860001, 41.892589705],
[61.2104923360001, 41.8925886540001],
[61.2104912090001, 41.8927686640001],
]
],
[ // area 2
[
[62.21079236, 41.892769716],
[61.2107934860001, 43.892589705],
[63.2104923360001, 41.8925886540001],
[61.2104912090001, 41.8927686640001],
[63.21079236, 43.892769716],
[61.21079236957, 41.892769716],
[63.210792368746, 44.892769716]
]
],
[ // area 3
[
[61.21079236, 41.892769716],
[61.2107934860001, 44.892589705],
[61.2104923360001, 41.8925886540001],
[61.2104912090001, 42.8927686640001],
[64.21079236, 41.892769716]
]
]
]
The data is stored in MONGODB. So I tried to solve the problem with MONGODB's Geospatial Queries with no luck.
I also tried to solve the problem with
Sutherland-Hodgman polygon clipping algorithm
but the algorithm did not work correctly(maybe implementation was wrong).
To visualize the problem:
interception is not allowed :
How can I solve the problem. Can you recommend any mongodb techniques, algorithms, packages or libraries?