查找给定的经纬度位于MongoDB中的任何多边形中 [英] Find if given lat-long lies in any of the polygon in MongoDB
问题描述
我想知道是否得到一个用户的经纬度,并且想要检查他是否位于存储在我的数据库(MongoDB)中的任何多边形中。这怎么能通过mongoDB来实现。
例如,我的db将有10个多边形存储为GeoJson对象。我得到一个经纬度,并且想要检查这个纬度长度是否在我DB中的10个多边形中的任何一个。
可以在MongoDB中实现吗?
对不起,只有通过两个链接,但我认为这些解释了什么做得更好,然后我会:
b
I want to know if I get a lat-long of a user and want to check if he lies in any of the polygon that is stored in my db (MongoDB). How can this be achieved using mongoDB. For instance my db will have 10 polygons stored as GeoJson objects. I get a lat-long and want to check if this lat-long lies in any of the 10 polygons in my DB. Can this be achieved in MongoDB?
Sorry to only past two links, but i think these explains what should be done far better then i would:
A SO answer in the same subject
An excellent tutorial how to use mongodb geospatial indexes
这篇关于查找给定的经纬度位于MongoDB中的任何多边形中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!