Tuesday, 21 January 2020

positionstack

(This is a sponsored post.)

Say you have an address that your user typed in, like

1600 Pennsylvania Avenue NW, Washington, DC, USA

and now you need more information about it. Maybe you need the proper country code. Maybe you need the latitude and longitude. Maybe you need the postal code.

positionstack is an API that does just that.

It works in reverse, too. So say you've got latitude and longitude, you might want to find out what is at that exact spot. You can send the API those coordinates and you'll get a response with what's there.

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",
         }
      ]
   }
}

This API is made by this company apilayer, which seems like a darn smart idea for a company. They make really specific APIs for all sorts of developer tasks.

Direct Link to ArticlePermalink

The post positionstack appeared first on CSS-Tricks.



from CSS-Tricks https://ift.tt/2ReRzTm
via IFTTT

No comments:

Post a Comment

Passkeys: What the Heck and Why?

These things called  passkeys  sure are making the rounds these days. They were a main attraction at  W3C TPAC 2022 , gained support in  Saf...