After the insane price hike of Google Maps, people are looking for its viable alternatives, including geocoding autocomplete services.
We had Google autocomplete text field in one of the apps, with some 20,000 plus autocompleted sessions a month (Google counts autocomplete by session, not per keystroke). We didn’t have the map, just the text field to fill out and select a place suggested in the Google’s default dropdown.
Our usage would easily exceed the limit of $200 free monthly credit, though not by much. But we set out to explore some alternative options that could get the job done for us, preferably for free.
It’s obvious that no other service comes close to Google Maps or Places in covering the whole world’s administrative data down to the street level. If you want a pin-point accuracy to your doorstep, this post won’t be much help.
Let’s go over some geocoding/autocomplete services:
TomTom is a good alternative if you want an autocomplete feature. It has a maps JS SDK for that, too. If I recall, in the SDK the search autocomplete comes embedded in the map, and you can’t have it separately like we wanted. For that, you can implement your own text autocomplete using their APIs.
Their price structure is not autosuggest friendly. They charge you by the transaction, unlike Google Maps which do that by the session. Meaning, that each keystroke fires an API call (one transaction). So 20,000 searches without session would amount to anywhere between 100,000 to a million transactions!
Again, very promising, but without the option to separate search box from the map. And again, they charge by the keystroke/call.
Additionally, their support response was super slow. I enquired about the above just to confirm my findings and they got back to me after a week.
3) Custom Implementation
I looked up JSON dump of world locations too. The biggest downside, as you might have guessed, is the lack of any detail in the data you find for free. It is countries, their states and cities, and at most a few localities, that too the US only. You can buy a bigger and paid data dump to somewhat overcome this issue.
One such data source I came across: GeoDataSource. They offer different Editions for World Cities, from Free to Titanium, that you can download. You can export this data to your a database and implement your own autosuggest API. To keep downloading the updated data monthly, you’ll need to subscribe to their non-free package, or else the data will become outdated after a while.
4) Scraping Google Maps
Disclaimer: I’m not encouraging or recommending anyone to take this route, just mentioning this as an option.
To pull it off, you will need:
- A scrapping script that simulates a user entering search words on Google Maps, and returning the autosuggested list that Google displays.
- Powerful proxy servers, the likes of trustedproxies and netnut, to send your scrapping calls through.
Obviously there are downsides, which are:
- Proxy servers are expensive.
- You will need a lot of maintenance of your scraping scripts to match Google updates on the maps. This might mean frequent downtime for your users.
- You will also need to update user-agents periodically, representing different latest devices and browsers, for Google to think they are real users making requests. Otherwise your requests will get recaptcha.
- Proxy servers get down often, for which a lot of back and forth with their support and server restarts are needed.
- Fetching autocomplete suggestions timely and efficiently might be challenging because the roundtrip time on each keystroke will be significant.
The depth of data it offers is quite impressive, and includes, among other things, information like budget, safety, covid and known for. You might not require these details for basic autocomplete implementations, though.
As for the amount of data, I cannot say anything. Their claim, however, is that they cover 7 continents, 232 countries, 450 regions, and more than 4,300,000 cities & towns, and (coming soon, they say) 200,000+ neighborhoods.
In terms of pricing, I believe they too are on the expensive side. The price is $0.0025 per call (or $2.5 per thousand calls), and they charge by the call/transaction instead of session (as Google does), which means to fetch autocomplete suggestions in your application you’ll end up making thousands of API calls per user.
The slight (or big, depending on your requirement) downside is: Here.js has limited data. For most little known countries (if that is what your app targets), it doesn’t go further than the country name and a few major cities. Only for the US, Canada, and the UK, its data reaches the administrative and local level. Here’s the geocoding example that can get you started.
Their pricing is solid, with 250,000 free transactions per month in freemium plan, with an option of additional 1000 calls per $1.
From what I have experienced, the two main issues in finding Google Places alternatives are the lack of detailed results outside the US, Canada, Great Britain, and some European countries, and the pricing model that these companies adopt (pay per call/transaction/keystroke instead of session). This means that you have to figure out if migrating from Google Places to one of these services is worth it or not in terms of results and price.
In short, if your application requires most of the searches in the above mentioned countries, and the volume of searches is small, then TomTom and Here.js are good options. On the other hand if the volume is large, and you need many cities across the world, then I’d suggest implementing your own custom autocomplete with a paid subscription of the data source provider, as it’ll still be cheaper than Google.