Menu

GeoDB Cities API

An Alternative To Google Places

In your search to find an API to get access to the world's cities, you've undoubtedly run across Google Places API. The Google service indeed does what it says - giving you access to all manner of places - including different levels of administrative districts, localities, businesses, and points of interest. But what happens when you just need a simple API to give you access to cities so you can say, autocomplete the city field of a user registration form? Below we compare GeoDB Cities with Google Places for this simple yet fairly common use-case.

For this comparison, we will use the following example: Let's say the user just entered the letters 'Los' and you want to fill your dynamic autocomplete widget with a list of top ten possible cities sorted by population, descending. 

The API Call

GeoDB

GET https://wft-geo-db.p.mashape.com/v1/geo/cities?namePrefix=Los&sort=-population&limit-=10

GeoDB neatly returns the top ten results, sorted as requested, in a single call.

Google Places

GET https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Los&types=cities

Google Places doesn't appear to offer a way to sort cities by population. Instead, it relies on an optional location restriction to give you more relevant results. (This way of restricting city results is also supported by GeoDB.) However, what if your location is the whole world (if say the user is searching for vacation destinations)?

We conclude that based on the existing Google Place Autocomplete docs, it doesn't seem currently possible to use the Google API to implement the above use-case in a single call.

Pricing

GeoDB

GeoDB offers a simple pricing model with generous request limits per tier. Specifically:

  • Pro Tier, $10/month: 1 million requests/day
  • Ultra Tier, $25/month: 10 million requests/day

This applies to any API endpoint.

Google Places

Good luck figuring out how much you'll pay here, but any cursory look at Google's convoluted pricing page should make it clear you'll be paying through the nose for usage that's even close to GeoDB's 1st-level Pro Tier plan. Keep in mind that you'll likely want to get place details after making the initial autocomplete request. The Google place-details call falls under a separate and more expensive pricing model.

Conclusion

In summary, with GeoDB, you get the cities you want, sorted in the way you want, and with minimal cost to you. In addition, we even offer a way to host your own GeoDB instance internally, so you have full control over the service within your own IT infrastructure. Don't let yourself be taken advantage of by big corporate giants who think you have no choice but to depend on their bloated over-priced APIs.

 

Significantly More Cities

The GeoDB import process has just been updated to include 16,000 additional cities. The current total now stands at over 135,000. Enjoy!

Host It Yourself!

Although GeoDB works pretty well as a hosted cloud service, you may require the kind of control and performance that can only come from managing your own dedicated in-house instance. We are proud to announce that this option is now available in the form of the new Self-Hosted tier.

The Self-Hosted tier allows you to host your own dedicated GeoDB instance with no restrictions on number of requests. Please see the updated pricing page for details.

Portuguese Now Available

GeoDB now supports base Portuguese (pt) and its Brazilian variant (pt_BR) as possible language translations, where data is available. If Brazilian Portuguese is requested but unavailable, the service will then attempt to get the base Portuguese version. If this too is missing, the service will fall back to English (as is currently done for other languages).

To find out the set of currently supported languages (and the codes to use), see the Get Languages API.

Other Enhancements

  • For operations returning collection results, you can now optionally suppress generation of HATEOAS paging links. If your code doesn't rely on these links, do this to receive a more compact (faster) response. See the new hateoasMode param described in the API docs.

Bug Fixes

  • Denmark regions are now correctly mapped.

Free Instance Changes

In an effort to maintain great performance on the Free instance while balancing CPU/bandwidth costs, we will soon be instituting a slight change to the available cities on this instance. Specifically, we will be limiting the total set of cities to only those with a population of at least 20,000 (based on GeoNames data).

If you require data on cities smaller than this, consider upgrading to one of the paid plans on the Pro instance.

More details once the change has been made, sometime in the next week or two.

View older posts »