2010-12-07 3 views
1

지도 기반 안드로이드 응용 프로그램을 구현 중입니다. 그 점에서 TopLeft와 Bottom 오른쪽에 핀을 표시하려고합니다. 다음은 내가 시도한 코드이다. 하지만 그것을 표시 할 수 없습니다. 이 좌표를 얻을 수있는 방법을 제안 해 주시겠습니까?안드로이드 SDK의 MapView 오른쪽 위 및 아래 오른쪽 경도 ​​및 위도

public GeoPoint topLeft(GeoPoint mapCenter, int latspan, int langspan) { 
int lat = (mapCenter.getLatitudeE6()) + (latspan/2); 
int lang = (mapCenter.getLongitudeE6()) - (langspan/2); 
return new GeoPoint(lat, lang); 
} 

public GeoPoint bottomRight(GeoPoint mapCenter, int latspan, int langspan) { 
int lat = (mapCenter.getLatitudeE6()) - (latspan/2); 
int lang = (mapCenter.getLongitudeE6()) + (langspan/2); 
return new GeoPoint(lat, lang); 
} 
+0

그 코드 자체는 아무 것도 알려주지 않습니다. 너는 어떻게 사용하고 있니? – skaffman

+0

위도와 경도는 어디에서 얻습니까? – CaseyB

답변

2

이와 비슷한 제품을 찾고 계십니까?

Projection proj = mapView.getProjection(); 
GeoPoint topLeft = proj.fromPixels(0, 0); 

GeoPoint bottomRight = proj.fromPixels(mapView.getWidth()-1, mapView.getHeight()-1); 

double topLat = topLeft.getLatitudeE6()/1E6; 
double topLon = topLeft.getLongitudeE6()/1E6; 
double bottomLat = bottomRight.getLatitudeE6()/1E6; 
double bottomLon = bottomRight.getLongitudeE6()/1E6; 

희망 하시겠습니까?

관련 문제