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.rapidapi.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: 200,000 requests/day
- Ultra Tier, $25/month: 1 million requests/day
This applies to any API endpoint.
Google Places
Good luck figuring out how much you'll pay here, but even a cursory look at Google's convoluted pricing page should make it clear you'll be paying through the nose for usage that's anywhere 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 even 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. 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.
Comments
There are currently no blog comments.