안드로이드 개발 질문/답변
(글 수 45,052)
구글맵의 API에서 현재 포인트의 주소를 알 수 있는 방법이 있을까요?
아니면 위,경도 좌표를 가지고 주소를 알수 있는 방법이 있는지 궁금합니다.
api를 찾아봐도 그런 내용이 없내요..
아니면 위,경도 좌표를 가지고 주소를 알수 있는 방법이 있는지 궁금합니다.
api를 찾아봐도 그런 내용이 없내요..
Geocoder _Geocoder = new Geocoder(this);
String _Result = "" ;
try
{
Iterator<Address> _Addresses = _Geocoder.getFromLocation(ClickLat, ClickLon, 1).iterator();
if (_Addresses != null) {
while (_Addresses.hasNext()) {
Address namedLoc = _Addresses.next();
String placeName = namedLoc.getLocality();
String featureName = namedLoc.getFeatureName();
String country = namedLoc.getCountryName();
String road = namedLoc.getThoroughfare();
_Result += String.format("\n[%s][%s][%s][%s]", placeName, featureName, road, country);
int addIdx = namedLoc.getMaxAddressLineIndex();
for (int idx = 0; idx <= addIdx; idx++){
String addLine = namedLoc.getAddressLine(idx);
_Result += String.format("\nLine %d: %s", idx, addLine);
}
}
}
}
catch (IOException e)
{
}