Forward/Reverse Geocoding Made easy with Positionstack

Positionstack is a service that helps you in Geocoding. You can use this service to forward and reverse geocode. For example, you can provide an address to get the latitude and longitude or you can provide the latitude and longitude to fetch the address.

Check out the product => Link to the home page.

Position stack

How to use Positionstack API

First create your free account in Positionstack. Click here to go to signup page.

Once your account is created, you can start using Positionstack APIs.

Here is an API call to perform forward geocoding.

http://api.positionstack.com/v1/forward?access_key=paste your access key here&query=1600%20Pennsylvania%20Ave%20NW,%20Washington%20DC

It will return the following response.

{
    "data": [
        {
            "latitude": 38.897675,
            "longitude": -77.036547,
            "type": "address",
            "name": "1600 Pennsylvania Avenue NW",
            "number": "1600",
            "postal_code": "20500",
            "street": "Pennsylvania Avenue NW",
            "confidence": 1,
            "region": "District of Columbia",
            "region_code": "DC",
            "county": null,
            "locality": "Washington",
            "administrative_area": null,
            "neighbourhood": "White House Grounds",
            "country": "United States",
            "country_code": "USA",
            "continent": "North America",
            "label": "1600 Pennsylvania Avenue NW, Washington, DC, USA"
        },
        {
            "latitude": 38.897498,
            "longitude": -77.037538,
            "type": "address",
            "name": "1600 Pennsylvania Avenue Northwest",
            "number": "1600",
            "postal_code": "20500",
            "street": "Pennsylvania Avenue Northwest",
            "confidence": 1,
            "region": "District of Columbia",
            "region_code": "DC",
            "county": null,
            "locality": "Washington",
            "administrative_area": null,
            "neighbourhood": "White House Grounds",
            "country": "United States",
            "country_code": "USA",
            "continent": "North America",
            "label": "1600 Pennsylvania Avenue Northwest, Washington, DC, USA"
        }
    ]
}

Here is an API call example of reverse Geocoding.

http://api.positionstack.com/v1/reverse?access_key=paste your access key here&query=40.7638435,-73.9729691

And, here is the output.

{
    "data": [
        {
            "latitude": 40.763841,
            "longitude": -73.972972,
            "type": "address",
            "distance": 0,
            "name": "767 5th Avenue",
            "number": "767",
            "postal_code": "10153",
            "street": "5th Avenue",
            "confidence": 1,
            "region": "New York",
            "region_code": "NY",
            "county": null,
            "locality": "New York",
            "administrative_area": null,
            "neighbourhood": "Midtown East",
            "country": "United States",
            "country_code": "USA",
            "continent": "North America",
            "label": "767 5th Avenue, Manhattan, New York, NY, USA"
        },
        {
            "latitude": 40.763841,
            "longitude": -73.972972,
            "type": "venue",
            "distance": 0,
            "name": "Apple Store",
            "number": "767",
            "postal_code": "10153",
            "street": "5th Avenue",
            "confidence": 1,
            "region": "New York",
            "region_code": "NY",
            "county": null,
            "locality": "New York",
            "administrative_area": null,
            "neighbourhood": "Midtown East",
            "country": "United States",
            "country_code": "USA",
            "continent": "North America",
            "label": "Apple Store, Manhattan, New York, NY, USA"
        }
    ]
}

Positionstack also provides embeddable maps which I believe is an awesome feature. it’s available only in the paid plan but it’s worth checking it out. You will receive a link to the embeddable maps along with each address object. Click on that link or embed it in your app to show the map of the address.

Pankaj Kumar
Pankaj Kumar
Articles: 207