查找给定的经纬度位于MongoDB中的任何多边形中 [英] Find if given lat-long lies in any of the polygon in MongoDB

查看:166
本文介绍了查找给定的经纬度位于MongoDB中的任何多边形中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否得到一个用户的经纬度,并且想要检查他是否位于存储在我的数据库(MongoDB)中的任何多边形中。这怎么能通过mongoDB来实现。
例如,我的db将有10个多边形存储为GeoJson对象。我得到一个经纬度,并且想要检查这个纬度长度是否在我DB中的10个多边形中的任何一个。
可以在MongoDB中实现吗?

解决方案

对不起,只有通过两个链接,但我认为这些解释了什么做得更好,然后我会:

同一主题中的SO回答



一本很好的教程,介绍如何使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆