Internet Promoted

Powerful Geocoding Meets Handy Features With the Positionstack API

Kris Wouk 06-01-2020

Computers work in absolutes. Thus, if you want a computer to do something, you need to tell it exactly what to do and how to do it. Take addresses, for example: We’re used to typing in rough approximations of addresses, but a computer won’t understand those—at least without a little help.

This is exactly what positionstack does for geocoding. With the service’s API and a little bit of code, you can easily add maps and location information to your website, but that’s just the beginning. Let’s look at it.

What Positionstack Does

In short, positionstack does both forward and reverse geocoding, but that won’t make much sense if you don’t know what geocoding is. The most common use case for geocoding is taking the way humans deal with addresses—street names and numbers, for example—and converting them into coordinates.

A demo of Positionstack features

Reverse geocoding performs the opposite process. If you have a given set of latitude and longitude coordinates, you can use reverse geocoding to turn these into a human-readable address, or at the very least, usually a city name.

The company behind positionstack has created several web services aimed at businesses. They’re all easy to learn and integrate; check out our overview of serpstack for another example.

Why You Might Need a Geocoding API

A simple use for geocoding is to help a customer find their way to your business. They can enter their address, or the address they might be traveling from, into a form on your website. Using the positionstack API, you turn that address into coordinates. From there, the customer can use an embedded map to help them find your local office.

Of course, that’s just one option. There are countless APIs and other services that use coordinate-based location data. Using positionstack, you can interoperate with many of these, and build a custom seamless user experience.

Example Go code for the Positionstack API

Reverse geocoding can be notoriously inaccurate. However, with positionstack we found the reverse geocoding to be not just accurate, but also quick. This also bears out in other reports we’ve seen from developers using the service. All you have to do is call the reverse API endpoint with the coordinates you need.

One of the other key features of positionstack is how easily it understands textual input. The forward geocoding API easily handles even loosely structured addresses, meaning you have less work cleaning up user input before passing it to the API. This can be handy—especially for prototyping—and isn’t easy to do.

Pricing for Positionstack

When you sign up for a positionstack account, the initial offering is completely free. This is great if you’re using the API for personal projects, and with a limit of 25,000 requests, you shouldn’t run out anytime soon. The free tier is also handy for evaluating the service without committing to yearly or monthly billing. Support is limited at this tier, but considering the price, that’s understandable.

Updating to the Basic tier adds several features, including HTTPS encryption and extended rate limits. It also has support for JSON, XML, and GeoJSON formats, plus embeddable maps and support for multiple languages. This tier also raises the request limit to 10,000 per month and 100,000 overall. It’s priced at $9.99 per month or $7.99 per month if you pay yearly.

Positionstack pricing

The Professional and Business tiers add just one additional feature: batch requests. These tiers significantly raise the request limits, which makes sense if you’re using positionstack for your business.

The Professional tier supports 50,000 monthly requests and 1,000,000 requests total. It comes at a cost of $49.99 per month, or $39.99 per month with yearly billing. Meanwhile, the Business tier supports 3,000,000 total requests and up to 250,000 monthly requests. You’ll pay $99.99 per month or $79.99 per month with yearly billing for this.

If you need something other than the standard tiers, positionstack also offers custom pricing and features tailored to your needs.

Getting Started With the Geocoding API

As with other services from this developer, getting started with positionstack is easy. You need two items: your API key and the API endpoint. Get your key by signing up on the positionstack website. The API endpoint is listed below:

https://api.positionstack.com/v1/forward

The API handles both JSONP callbacks and Access-Control (CORS) headers. This lets you easily work with positionstack, no matter what technologies you already use.

A JSONP callback example

For a very simple example, here is a sample text query which will return geocoding data:

https://api.positionstack.com/v1/forward
? access_key = YOUR_ACCESS_KEY
& query = 1600 Pennsylvania Ave NW, Washington DC

Advanced API Features

There are plenty of geocoding services available, so an offering like positionstack has to go above and beyond to compete. The service does this primarily by adding a few killer features.

In addition to the standard forward and reverse geocoding API endpoints, positionstack supports more advanced functionality. For example, if you’re on any tier above the basic free tier, API responses will include a map_url object that points to an embeddable map to include on your website.

Embeddable maps in the Positionstack API

If you’re dealing with international customers, the Country module may come in handy. All you need to do is add the country_module HTTP GET parameter to your API request and you’ll get much more country data. This includes currency information, the spoken language, and even an icon of the country’s flag.

The Country Module isn’t the only extra module you’ll find included in positionstack. The service also offers a Sun Module, a Timezone Module, and a Bounding Box module.

Try Positionstack for Free

If you’re not sure whether positionstack will meet your needs, you don’t need to spend any money to find out. As mentioned earlier, the service offers a free tier that lets you get to know it. While you don’t get every single feature, it exposes enough of the API to let you determine whether it will work with your existing code.

Once you’ve seen how easy it is to use the API, you might want to see some of the other services the developer offers. For using weather data on your website, take a look at our rundown of weatherstack Integrate Weather Data on Your Homepage With Weatherstack API The weatherstack API provides an easy way to add weather data to your website or app, and it's free to start. Read More , which should work well with geocoding and location data. Also, you can integrate flight data into your projects with the aviationstack API Integrate Flight Data Into Your Projects With aviationstack The aviationstack API lets you add useful flight data to your website with little effort. Here's how to start using it right away. Read More .

Explore more about: API, Location Data, Webmaster Tools.

Whatsapp Pinterest

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *