2011-07-17 3 views

답변

2

는 내가 API를 속도 제한되어 있다고 생각합니다. 즉, 한 시간에 여러 번 이상 API를 사용할 수 없습니다. Android에는 ReverseGeocoding을 수행하는 Geocoder 클래스가 포함되어 있습니다. this link을 살펴보십시오.

+0

감사합니다. 이것이 내가 필요한 것이라고 생각합니다. 나는 지금 그것을 시험 할 것이다. – mohamede1945

+0

나는 그것을 테스트했지만 도시를 얻는 데 사용할 수는 없다. 이 작업을 수행하는 방법을 알고 있습니까? – mohamede1945

+0

매니페스트에 인터넷 권한이 있어야합니다. '지오 코더 지오 코더 = 새로운 지오 코더 (this, Locale.getDefault()); 리스트

주소 = geocoder.getFromLocation (lat, lng, 1); addresses.get (0) .getLocality();'지역은 당신에게 도시를 제공해야합니다. – Varun

1

요청하는 무엇을 제공합니까 생각 getAddressLine 가야한다. 다음은 시애틀 근처에 이름을 찾기 위해 샘플 API 호출입니다 : http://api.geonames.org/citiesJSON?north=47.65&south=47.55&east=-122.30&west=-122.40&lang=de&username=demo

{ 
    "geonames": [ 
     { 
      "fcodeName": "seat of a second-order administrative division", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Seattle", 
      "wikipedia": "", 
      "lng": -122.3320708, 
      "fcode": "PPLA2", 
      "geonameId": 5809844, 
      "lat": 47.6062095, 
      "population": 608660 
     }, 
     { 
      "fcodeName": "populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Yesler Terrace", 
      "wikipedia": "", 
      "lng": -122.3159591, 
      "fcode": "PPL", 
      "geonameId": 5816674, 
      "lat": 47.6009318, 
      "population": 0 
     }, 
     { 
      "fcodeName": "section of populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "North Broadway", 
      "wikipedia": "", 
      "lng": -122.3204044, 
      "fcode": "PPLX", 
      "geonameId": 5804929, 
      "lat": 47.6462094, 
      "population": 0 
     }, 
     { 
      "fcodeName": "populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Capitol Hill", 
      "wikipedia": "", 
      "lng": -122.3195706, 
      "fcode": "PPL", 
      "geonameId": 5789123, 
      "lat": 47.6234317, 
      "population": 0 
     }, 
     { 
      "fcodeName": "populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Interbay", 
      "wikipedia": "", 
      "lng": -122.3959623, 
      "fcode": "PPL", 
      "geonameId": 5798384, 
      "lat": 47.641209, 
      "population": 0 
     }, 
     { 
      "fcodeName": "populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Ross (historical)", 
      "wikipedia": "", 
      "lng": -122.3623502, 
      "fcode": "PPL", 
      "geonameId": 5808844, 
      "lat": 47.6478758, 
      "population": 0 
     }, 
     { 
      "fcodeName": "populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Stevens", 
      "wikipedia": "", 
      "lng": -122.3066667, 
      "fcode": "PPL", 
      "geonameId": 7153940, 
      "lat": 47.6297222, 
      "population": 0 
     }, 
     { 
      "fcodeName": "section of populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Belltown", 
      "wikipedia": "", 
      "lng": -122.3509605, 
      "fcode": "PPLX", 
      "geonameId": 5786913, 
      "lat": 47.6164871, 
      "population": 0 
     }, 
     { 
      "fcodeName": "populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "Queen Anne", 
      "wikipedia": "", 
      "lng": -122.366239, 
      "fcode": "PPL", 
      "geonameId": 5807648, 
      "lat": 47.6359314, 
      "population": 0 
     }, 
     { 
      "fcodeName": "populated place", 
      "countrycode": "US", 
      "fcl": "P", 
      "fclName": "city, village,...", 
      "name": "South Seattle", 
      "wikipedia": "", 
      "lng": -122.312903, 
      "fcode": "PPL", 
      "geonameId": 5811509, 
      "lat": 47.5614876, 
      "population": 0 
     } 
    ] 
}