获得位置的地址w.r.t我在多边形 [英] get location address w.r.t the polygon I am in

查看:138
本文介绍了获得位置的地址w.r.t我在多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有超过200个多边形来创建和我所得到LocationListenerOnChanged的位置(),但我想知道我在基于当前位置的这些多边形。

I have over 200 polygons to create and I get the location by LocationListenerOnChanged() but I would like to know which polygon I am in based on the current location .

我将如何使用经纬度每个多边形每2英里。并且在中签我怎样才能使整个过程更快或将Android操作系统具有内置的功能。

How will I use LatLng to check within within each polygon every 2 miles.And how can I make the entire process faster or will android os has inbuilt function.

我查了很多有关Android地图V2文件,但我没有得到任何信息关于它。我AP preciate w.r.t话题.Thanks任何帮助提前。

I checked a lot of documents related android maps v2 but I did not get any info about it.I appreciate any help w.r.t the topic .Thanks in advance.

推荐答案

有采用的是Android API V2没有直接的方法来知道一个多边形内的经纬度谎言。所以,你需要做的称为<​​STRONG>里面的多边形点查看一个mathemetical计算。你可以看看前面的帖子建议以下两种方法:

There is no direct method in android api v2 to know if a latlng lies within a polygon. So you need to do a mathemetical calculation known as point inside polygon check. You can check out the below two methods suggested in earlier posts:

1,<一href=\"http://stackoverflow.com/questions/14405593/polygon-touch-detection-google-map-api-v2\">Raycasting方法

2,<一href=\"http://stackoverflow.com/questions/14348589/implementing-polygons-with-google-maps-api-v2-in-android\">Winding数法

如果你的情况,检查点对所有200个或更多的多边形正在放缓您的应用程序,你可以考虑减少检查多边形数量。首先,对于每个多边形,比它们的顶点外,还存放一个近似几何中心。然后当你为检查一个新的位置,发现这个位置与所有多边形的几何中心之间的距离。现在,只需要很少的多边形(比如8),其中心是最接近点,然后做任何上述的点内的多边形检查这些选择的多边形。

If in your case, checking a point against all 200 or more polygons is slowing your app, you can consider reducing the number of polygons to be checked. First of all , for each polygon, other than their vertices, also store an approximate geometric center. Then when you get a new location for checking, find the distance between this location and the geometric center of all the polygons. Now take only few polygons ( say 8) whose centers are closest to the point and then do any of the above point inside polygon check for those chosen polygons.

这篇关于获得位置的地址w.r.t我在多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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