주소로부터 위도 경도를 얻어올수있나요?
조회수 2431회
1 답변
-
public GeoPoint getLocationFromAddress(String strAddress){ Geocoder coder = new Geocoder(this); List<Address> address; GeoPoint p1 = null; try { address = coder.getFromLocationName(strAddress,5); if (address==null) { return null; } Address location=address.get(0); location.getLatitude(); location.getLongitude(); p1 = new GeoPoint((int) (location.getLatitude() * 1E6), (int) (location.getLongitude() * 1E6)); return p1; } }
strAddress는 주소를 포함한 문자열이고 address 변수는 변환된 주소를 저장합니다.
댓글 입력