Google Places API Alternative in React Native: TomTom Fuzzy Search API + react-native-autocomplete-input

On July 16, 2018, pricing changes for Google’s Map and Places APIs went into effect that priced out many developers, including myself, from using them anymore. (My API usage used to fall within their free tier usage, but would now cost me about a grand a month with their new pricing structure. Goodbye, Google!)

And so began the hunt for Google Maps and Places API alternatives:

  • For mobile developers who only needed maps, life is good because using the Google Maps SDKs for Android and iOS still allow unlimited map loads
  • For web users who need embedded or static maps for their sites, a few established and well-documented alternatives exist, including various OpenStreetMap providers and Azure Maps. A pain to have to switch providers, but definitely doable!

But there was one place where I had trouble finding an alternative: the Google Places API, specifically it’s autocomplete search that lets you bias toward nearby places. The most promising API alternative was TomTom’s Fuzzy Search API, which has a pretty generous free tier usage (2500 queries a day), supports location biasing, and even has a parameter to signal whether to use predictive text completion/treat the input as an autocomplete-able query. Awesome and, as of July 16th, definitely cheaper than using Google Places!

But unfortunately, unlike the Google Places API, I couldn’t find a React Native implementation of the TomTom Fuzzy Search API, with or without autocomplete support. But I did find a React Native autocomplete input library, with a great example that used a Star Wars API to query/autocomplete various movies. All I had to do was make a few changes, swap the TomTom Fuzzy Search API in place of the Star Wars API, and I had a MVP of a React Native input component for finding nearby locations, at a cost far less than using the popular Google Places autocomplete library. Here’s what it looks like, with a search biased to San Francisco (click Tap to Play. Hopefully my API key doesn’t run out of calls by the time you read this!):

 

You can probably tell I’m pretty new to using React Native from my code, but hey, it works. I’m just hoping writing about my experience will help others looking for Google Places API alternatives realize TomTom’s API is a pretty good candidate. And if you happen to use React Native with the Google Places API, maybe my pretty noob-ish example can help guide you in the right direction for your own, far better, implementation.

The TomTom API still isn’t quite as nice as Google’s: I couldn’t find the 9:30 Club, even when biased to Washington DC/encoded properly, and the places seem to be more outdated (I could only find the Washington Capitals and Washington Wizards arena with its old name, Verizon Center, as it did not come up in a search for Capitol One Arena.) But for hobbyist developers like myself, the sacrifice in data quality is a necessary trade-off for being able to offer apps without losing thousands of dollars!

  2 comments for “Google Places API Alternative in React Native: TomTom Fuzzy Search API + react-native-autocomplete-input

  1. Victoria
    July 24, 2018 at 5:42 pm

    so helpful! thanks!

  2. david
    August 27, 2020 at 2:07 am

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.