내 MapView의 화면 좌표를 저장하려면 어떻게해야합니까? (보이는 rect rect left-top 및 zoomlevel) 잠시 후에 해당 코드를 다시로드하고 싶습니다. 어떻게해야합니까?Android MapView의 화면 좌표를 가져 오는 방법은 무엇입니까? (보이는 사각형)
감사합니다, 레슬리
내 MapView의 화면 좌표를 저장하려면 어떻게해야합니까? (보이는 rect rect left-top 및 zoomlevel) 잠시 후에 해당 코드를 다시로드하고 싶습니다. 어떻게해야합니까?Android MapView의 화면 좌표를 가져 오는 방법은 무엇입니까? (보이는 사각형)
감사합니다, 레슬리
질문에 대한 답을 발견 한 경우 나도 몰라, 그래서 당신에게 내 솔루션을 보여 드리겠습니다. 다음 코드를 MapView 클래스의 하위 클래스에 추가했습니다.
GeoPoint topLeft = this.getProjection().fromPixels(getLeft(), getTop());
GeoPoint bottomRight = this.getProjection().fromPixels(getRight(), getBottom());
int topLat = topLeft.getLatitudeE6();
int topLng = topLeft.getLongitudeE6();
int bottomLat = bottomRight.getLatitudeE6();
int bottomLng = bottomRight.getLongitudeE6();
도움이되기를 바랍니다.
가시 영역의 좌표 (MapView
모서리)를 알 필요가 없습니다. 화면 중앙과 줌 레벨로 충분합니다.
// obtain and persist this values
GeoPoint center = mapView.getMapCenter();
int zoomLevel = mapView.getZoomLevel();
// later restore them when you need
GeoPoint center = ...;
int zoomLevel = ...;
// and init your MapView with this values
MapController controller = mapView.getController();
controller.setZoom(zoomLevel);
controller.animateTo(center);
위도와 경도를 의미합니까? –
내지도보기의 보이는 사각형을 의미합니다. 다음과 같은 코드 : savepointsonmap = mapview.getPointCoordsOnVisibleRectFromTopLeft(); mapview.setCoords (savedpointsonmap)보다; 또는 비슷한 것 ... 또는 내 눈에 보이는 rect의 왼쪽 위도/경도를 저장하고 위도/경도를로드하는 방법 – lacas