위도/경도와 API가 도시 이름을 반환하도록 내 안드로이드 응용 프로그램에 API (지원되는 경우 Google지도가 선호 됨)를 사용하고 싶습니다. . 이에 대한 해결책에 API는 경도/위도를 반환하고 도시 이름을 반환합니다.
, 당신 (x)는
2
A
답변
2
는 내가 API를 속도 제한되어 있다고 생각합니다. 즉, 한 시간에 여러 번 이상 API를 사용할 수 없습니다. Android에는 ReverseGeocoding을 수행하는 Geocoder 클래스가 포함되어 있습니다. this link을 살펴보십시오.
2
내가 구글은 당신이 Geonames.org이 다른 여기 http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding
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
}
]
}
감사합니다. 이것이 내가 필요한 것이라고 생각합니다. 나는 지금 그것을 시험 할 것이다. – mohamede1945
나는 그것을 테스트했지만 도시를 얻는 데 사용할 수는 없다. 이 작업을 수행하는 방법을 알고 있습니까? – mohamede1945
매니페스트에 인터넷 권한이 있어야합니다. '지오 코더 지오 코더 = 새로운 지오 코더 (this, Locale.getDefault()); 리스트
주소 = geocoder.getFromLocation (lat, lng, 1); addresses.get (0) .getLocality();'지역은 당신에게 도시를 제공해야합니다. – Varun