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

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -