2012-02-27 3 views
0

osmdroid MapView를 사용합니다. 사용자가지도 경계 내에서 위치를 확인할 필요가 있습니다 (확대/축소 수준에 따라 다름).특정 위치가지도 경계 내에 있는지 확인해야합니다.

사용자 MapView.getBoundingBox(). contains (location) ..하지만 getBoundingBox()가 Visible 경계를 반환하는 것으로 보입니다.

원래지도 경계를 얻는 방법은 있습니까 (확대/축소 수준에 따라 다름)? 관심의 포인트가 속하는 경우 다음 찾을 수 있습니다

GeoPoint topLeftGpt  = (GeoPoint) mapView.getProjection().fromPixels(0, 0); 
GeoPoint bottomRightGpt = (GeoPoint) mapView.getProjection().fromPixels(
      mapView.getWidth(), mapView.getHeight()); 

:

감사

답변

3

당신은 위도와 북서쪽의 경도와 같은 코드 남동쪽 모서리하여지도보기의 을 찾을 수 있습니다 이 범위. V2를 들어

0

:

LatLng northwest = (LatLng) mMap.getProjection().fromScreenLocation(new Point(0, 0)); 
    LatLng southeast = (LatLng) mGoogleMap.getProjection().fromScreenLocation(
     new Point(mMapView.getWidth(), mMapView.getHeight())); 
관련 문제