python - Pymongo search geo on line -
There is a collection with my geographic coordinates. I use commands in this way to find objects in the circle
collection.find ({"loc": {"$ inside": {"$ center": [[49.236484,28.472172], 10]}}})
But do I need to find the object on the road (line)? how can I do this? And please tell me that my order will search right. Thank you.
Why not use $ polygon to essentially create a thick line?
collection.find ({'loc': {'$ inside': {'$ polygon': [[linestart_x, linestart_y], [linestart_x + jiggle, linestart_y + jiggle], [lineend_x , Lineend_y] [Lineend_x + jiggle, lineend_y + jiggle]]}}})
You have to experiment to find a proper number of 'jiggle'.
Enjoy!
Comments
Post a Comment