Where to Eat? Custom maps of OpenStreetMap data

Where to eat in Middlebury?

A long running topic of discussion with my colleagues is: “Where should we eat for lunch?” Our small rural town has a pretty vibrant dining scene for its population with between 40-50 establishments that serve food or drink. This number is just large enough to be too much to keep in one’s head easily, but not so large as to feel like there are novel options around every corner. While I and other contributors have entered most of our town’s establishments into OpenStreetMap (OSM), the default rendering on openstreetmap.org doesn’t show restaurants until zoomed way in and their small orange dots aren’t very easily pick out on even a mid-zoom overview map.

To fill the gap I used a few a few free web-based tools (Overpass Turbo & uMap) to put together this custom map that highlights all of the places to eat (or get coffee/drinks) in Middlebury:

Where to eat in Middlebury

Map screen shot of Middlebury with POIs highlighted.

If you want to view these results for other places in the world, I put together the same queries, but not bounded to a particular location at: Where to Eat? This version will update the results as you move around the map. Please note that urban areas with high density may have too many results when zoomed out to render correctly.

Background

OpenStreetMap (OSM) is a world-wide, collaboratively-edited database of geographic information that can be used to create maps of the world, route from place to place, or analyze geographic relationships. The main map at openstreetmap.org strives to be a general-purpose rendering that is useful for many people and many purposes, but in optimizing for broad utility, it isn’t always able to surface features of particular interest to the viewer. In contrast, other renderings like OpenCycleMap, OpenTopoMap, OpenRailwayMap, OpenSeaMap, the Noise Pollution Map and my own Road Curvature all use OSM data and make custom renderings targeted at a specific audience or use. While these alternative renderings are fabulous resources, building and setting up the servers, databases, and rendering pipelines required to render such a global map is a big lift that is beyond the reach of most people. As it turns out, there is a much easier way to present custom maps of data in OSM without needing any server resources or programming.

Querying the data

This first tool  to become acquainted with is the Overpass Turbo service. The Overpass API is a mechanism to query and report on objects in the OSM database and Overpass Turbo (docs) is a user-interface that can help you build queries and easily view the results.

To find all of the dining establishments I used Overpass Turbo to query all of the objects that were tagged with food-related tags like amenity=restaurant, amenity=cafe, amenity=fast_food, shop=bakery (because they often sell sandwiches as well), or other places with any cuisine=* or takeaway=* tags. Building my query took a little trial and error, but I eventually tweaked it enough to get the data set I wanted.

One change from the defaults provided by the wizard was to print the results with out center; to only load the center point of buildings as a point instead of the default of out skel; which shows building outlines as a shape.

The results of this query can be viewed here: http://overpass-turbo.eu/s/R6e

Screen-shot of the Overpass Turbo UI for my 'where to eat' query.

Rendering the results

For many purposes, the saved results from Overpass Turbo may be sufficient and no further effort is needed. I wanted to see if I could provide nicer labels and points, and found this great tutorial on how configure the uMap service (which allows you to make custom maps) to import remote data points from an Overpass query. I mostly followed the tutorial, but tweaked my map in a few ways:

  • I expanded the info boxes to pull extra details from the objects to show opening hours and phone numbers.
  • For the Middlebury-only version I hard-coded the query-bounds and made the query non-dynamic so that it would load all establishments in the town when first displaying the map, even if the viewport is constrained to a smaller area due to screen-size. This improved performance of the map by not needing to refresh the data and allows the data-listing table to show all establishments without having the list change as they scroll into and out of view.

If you’d like to examine the exact settings for my uMap map, I’ve exported its full configuration.

Leave a Reply

Your email address will not be published.