Check if point is in polygon with Google Maps API in Android

后端 未结 2 826
我在风中等你
我在风中等你 2021-01-05 03:52

I am using the Google Maps API on Android to create a puzzle. This link contains the data I used to draw African countries: World countries coordinates.

When the use

2条回答
  •  既然无缘
    2021-01-05 04:10

    A bit later response, but for future searches, you can also check if a location is inside the current visible map area by using:

    // Kotlin code
    var location = LatLng(-27.6016488, -48.5137219)    
    val isInside = mGoogleMap.projection.visibleRegion.latLngBounds.contains(location)
    

    Documentation link: contains (LatLng point)

提交回复
热议问题