positionstack

❥ 赞助商

假设你有一个用户输入的地址,比如 **1600 Pennsylvania Avenue NW, Washington, DC, USA**,现在你需要更多关于它的信息。也许你需要正确的国家代码。也许你需要经纬度。也许你需要邮政编码。

positionstack 是一个可以做到这一点的 API

它也可以反向工作。所以假设你拥有经纬度,你可能想知道那个确切位置有什么。你可以将这些坐标发送给 API,你将收到一个包含那里内容的响应。

https://api.positionstack.com/v1/reverse
    ? access_key = YOUR_ACCESS_KEY
    & query = 40.7638435,-73.9729691
{
   "data": {
      "results": [
         {
            "latitude": 40.763841,
            "longitude": -73.972972,
            "label": "Apple Store, Manhattan, New York, NY, USA",   
            "name": "Apple Store",
            "type": "venue",
            "distance": 0,
            "number": "767",
            "street": "5th Avenue",
            "postal_code": "10153",
            "confidence": 1,
            "region": "New York",
            "region_code": "NY",
            "administrative_area": null,
            "neighbourhood": "Midtown East",
            "country": "United States",
            "country_code": "US",
            "map_url": "http://map.positionstack.com/40.763841,-73.972972",
         }
      ]
   }
}

这个 API 是由该公司 apilayer 制作的,这似乎是一个非常聪明的公司想法。他们为各种开发任务制作了非常具体的 API

直接链接 →