2

我想在我的android应用程序中使用一个API(如果支持的话,最好是谷歌地图)来传递一个位置的经度/纬度,API返回城市名称。

在解决方案中,您应该使用 getAddressLine(x)

4

3 回答 3

2

我相信谷歌确实提供了你在这里请求的内容 http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding

于 2011-07-17T01:13:18.070 回答
2

我相信 API 是有速率限制的。即你不能在一个小时内多次访问 API。Android 包含一个 Geocoder 类,它也执行 ReverseGeocoding。看看 这个链接

于 2011-07-17T01:44:37.877 回答
1

Geonames.org 是另一个。这是一个用于查找西雅图附近名称的示例 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
        }
    ]
}
于 2011-07-17T01:31:04.400 回答