简体   繁体   English

如何使用Google Maps API和Java定义自定义区域

[英]How to define custom area using Google Maps API and Java

I'm trying to build an application with Java where I need to define some custom areas which are not readily available (eg jurisdictions for different police stations or fire stations in a city). 我正在尝试使用Java构建应用程序,在其中我需要定义一些不容易使用的自定义区域(例如,城市中不同警察局或消防局的管辖范围)。 My goal is to find out that, given an user's location, which jurisdiction that is a part of. 我的目标是找出给定用户的位置的哪个管辖区。 I tried the Google Maps API, but couldn't find a solution. 我尝试了Google Maps API,但找不到解决方案。

Can anyone please help me find the solution using Google Maps API or any other API. 任何人都可以使用Google Maps API或任何其他API来帮助我找到解决方案。

You can try using PolyUtil.containsLocation(LatLng point, List polygon, boolean geodesic) from Android-map-utils 您可以尝试从Android-map-utils使用PolyUtil.containsLocation(LatLng点,列表多边形,布尔测地线)

That given the list of latitude and longitude that defines your custom areas you can check if current location is inside or not. 给出定义您的自定义区域的经度和纬度列表后,您可以检查当前位置是否在内部。

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

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