简体   繁体   English

Google映射边界多边形

[英]Google maps bounding polygons

I need to be able to do spatial queries to determine if a lat/long coordinate exists inside a polygon. 我需要能够进行空间查询以确定多边形内是否存在纬度/经度坐标。 I know that you can define bounding boxes and do queries like that, but can you do the same with custom shapes? 我知道您可以定义边界并执行类似的查询,但是您可以对自定义形状执行相同的操作吗?

As an overly simplified example, lets say I need to be able determine if a lat/long point (X,Y) is within 20 miles of the western coast of the US. 作为一个过于简化的例子,假设我需要能够确定纬度/长点(X,Y)是否在距离美国西海岸20英里的范围内。 Lets say I already have the means to draw a line "parallel" to the coast, 20 miles out, and connect that line to the coast line at the top and bottom. 假设我已经有办法在距离海岸20英里的地方“平行”划线,并将该线连接到顶部和底部的海岸线。 I want to test if the point (X,Y) is inside the polygon bounded by those lines. 我想测试点(X,Y)是否在由这些线限定的多边形内。

Is this possible using the native Maps API? 这可以使用原生Maps API吗? If not, is there an additional plugin that will allow me to do this? 如果没有,是否有一个额外的插件可以让我这样做?

The Google Maps API v3 includes the containsLocation method , which takes a LatLng and a Polygon and returns a boolean. Google Maps API v3包含containsLocation方法 ,该方法采用LatLng和Polygon并返回布尔值。 Not sure what you mean by the "native Maps API". 不确定“native Maps API”是什么意思。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM