Google Map v2 check whether the point contains in area

我的梦境 提交于 2021-02-08 19:27:09

问题


all. I am trying to check the point that user taps on the google map whether in specific area, does google map api v2 have any method that i can quick to use?


回答1:


You can use LatLngBounds. It has contains method which returns true when given LatLng is inside bounds. If you want to get current visible region I recommend reading: https://stackoverflow.com/a/14700745/759007 .




回答2:


You should use Location APIs

https://developer.android.com/google/play-services/location.html

Inside em, you can use:

http://developer.android.com/training/location/geofencing.html

Hope it helps you,

Regards




回答3:


yes you can using map.setOnMapClickListener which will return the latlng and you can use this where ever you need:

map.setOnMapClickListener(new OnMapClickListener() {
    @Override
    public void onMapClick(LatLng point) {
        // your code                    
    }    
}


来源:https://stackoverflow.com/questions/29766962/google-map-v2-check-whether-the-point-contains-in-area

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!