Log in to follow projects

Following a project allows you to receive updates via email. It also lets the owner know that you like them.

×

Walkable restaurants

By Tim Smith

Which geographical points have the most restaurants within walking distance?

100% complete
1 follower 1136 views
About Log (0) Discussion (0)

Walkable restaurants


https://timlabs.org/walkable/

Back when people would actually come in to the office, my coworkers and I used to go out to lunch regularly, walking to the many restaurants nearby. That got me wondering which places have the most restaurants within walking distance, so I made this project to find out. It turned out to be an interesting exercise in geographical computation.

To get the restaurant data, I used the Yelp API to query for restaurants within a given radius of a point. But each such area only covered a small portion of the Earth's surface. To handle the whole planet, I needed to cover the Earth in such a way that no points were left out. It took me a while to figure out how to do this, but eventually I was able to "tile the Earth" using a recursive process. Getting the details right was tricky, and I had to learn a lot about spherical geometry.

Once I had the restaurant data, I needed a way to find out which "walkable circles" had the most restaurants. I found an answer on Stack Overflow that gave me the basic algorithm, which uses a clever idea about translation and rotation to reduce the number of circles that need to be examined. I implemented it in Elixir, a programming language I had not previously used. Overall it was a good coding experience, although I found the language to be a bit clunky in places.

Finally, I made a frontend web page to present the results, incorporating various tools that query an Elixir backend deployed as a Docker container. One limitation is that most of the tools only work for the US, because I stopped gathering data after that, due to it taking too long. Expanding it to other countries would be straightforward, but time-consuming.

Now after all that work, I feel hungry. Hmm, which restaurant should I walk to...?