Menu

GeoDB Cities API

Host It Yourself!

GeoDB can now easily be hosted in your own environment as a Docker container. This may make sense if you have any or all of the following requirements:

  • Maximum performance
    • A dedicated instance that's not shared with other users
    • Colocation with other services to maximize response throughput and minimize latencies
    • No Rapid API proxy layer
    • No request-throttling limits
    • Up to 5 load-balanced instances
  • No max-paging-limit restrictions
  • Unlimited requests
  • Full control over the instance

All new self-hosting plans start with a free two-week trial. See pricing for details.

Major Data Update

We have been working hard over the past few months and are proud to announce the following updates:

  • Data has almost doubled to currently over 266,000 cities and towns.
  • Data is now over 95% correlated with Wikidata.
  • All invalid region mappings have been addressed.
  • The database logic has been completely rewritten to improve response times and throughput.

In addition, GeoDB now hosts its own dedicated Wikidata instance that syncs regularly with the mothership. This will allow us to expand city details with new interesting Wikidata factoids in the future.

 

Last but definitely not least, everyone please stay safe and healthy. May these grim fearful days soon be a distant memory for us all.

 

Administrative Divisions Are Here

In addition to regular cities and towns, GeoDB now supports 2nd-level administrative divisions, with currently over 17,000 in the database. These typically represent counties and districts, depending on the country.

Because the difference between what is considered a city or a district can sometimes be a matter of semantics in certain countries, GeoDB returns both types by default from any of the existing cities endpoints. To delineate between the two, all cities endpoints now expose a new optional types param which can be used to specify one or the other type (CITY or ADM2) to return.

In addition, the following new endpoint operations are now available to explicitly support returning administrative divisions only (this is a convenience as all of the same data may be returned from existing cities endpoints using types=[ADM2] as a constraint):

Please have a look at the updated docs for full details. Enjoy!

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 thousands of additional cities and counties. The current total now stands at over 136,000. Enjoy!

View older posts »