티스토리 툴바

달력

052012  이전 다음

  •  
  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
1. Geocoder
- 주소를 가지고 latitude와 longitude를 얻어내는 방법
Geocoder geocoder = new Geocoder(this);
try {
    List
addresses = geocoder.getFromLocationName(address, 1); if (addresses != null) { result = addresses.get(0).toString(); } } catch (IOException e) { Log.e("GeocodExample", "Error", e); }

2. Reverse Geocoding
- latitude와 longitude를 가지고 주소를 얻어내는 방법
location = locationManager.getLastKnowLocation(LocationManager.GPS_PROVIDER);

double latitude = location.getLatitude();
double longitude = location.getLongitude();

List< Address > addresses = null;
Geocoder gc = new Geocoder(this, Locale.getDefault());
try{
    addresses = gc.getFromLocation(latitude, longitude, 10);
}catch (IOException e){ }
Posted by 파이드라