On vacation, and faced the usual dilemma: where to eat? I might side-eye Google for many reasons, but their data? Can’t deny it’s good. Given they’ve probably seen my plans via other household searches, I piped into their API for food intel. It’s “free” until you hit their limit. Here’s a script to fetch the nearby eats.

Introducing: nomad-diner

Features:

  • Location-based Searching: Drop an address or coordinates, and it spits out restaurants.
  • Filters: Need at least a 4-star place? Or maybe you’re on a budget? The script’s got you covered.
  • Search Term: Fancy sushi or perhaps a burger joint? Toss in a keyword.
  • Driving ETA: If you think about driving, the script can give you a rough estimate of the time involved.

How It Operates:

  • Coordinate Acquisition: The script accommodates both addresses and coordinates. Feed it an address, and it converts it into latitude and longitude.
  • Efficient Filtering: By setting max_results and distance, you can further refine the results to more manageable numbers.
  • Fetching the Essentials: Interacting with Google Places, the script curates a list of restaurants tailored to your criteria. For a comprehensive insight, it delves into detailed data for each establishment.
  • Drive Time Calculation with Haversine Distance: Before the script decides to fetch the estimated driving time, it employs the Haversine Distance formula as a preliminary check. If a place is, say, only 100 meters away, there’s little sense in calculating driving time. The eta_threshold option in the script ensures unnecessary API calls are avoided.

Command-line Simplified:

The script runs from the command line. Here’s a sample command:

python script_name.py "Tokyo" --distance 5000 --min-rating 4.5 --max-price 2

This gets you restaurants within 5 kilometers of Tokyo, rated at least 4.5, with a price that won’t break the bank.

Final Thought:

Vacations should be about the experience, not not wrestling with meal choices. Hopefully this script helps someone else sidestep the food-finding fuss.