Jun 30, 2017

Querying OSM for stops alongside motorways

While covering some distance on Autobahnen I reminisced on hitchhiking days. Asking yourself through rest areas and fuel stations proved to be a quicker way to get on instead of smiling into car windows along roadsides. Some understanding helped of when the last opportunity will come to depart the current highway to hitch a ride in the direction of your destination. Country overview maps by merchandisers servicing bigger fuelstations help with this. Currently, such a view can be obtained via search for highway number at maps.rast.de which also provides a list of all stations. I wondered if Openstreetmap can provide a similar view. Using overpass-turbo as Overpass API client, the introspection tool ("?"-symbol) of openstreetmap itself and keeping an eye on query slot status got me going. Specifics on germanys motorways and multiple examples and utilities helped to form a rough query.

This is restricted to a bounding box the A4 runs through.

    relation[network=BAB][ref="A 4"](50.797500,9.4400024,51.027820,13.263245);
((.services; .restareas; .parkinspace; .fuelstations;);>;);
out meta;


{ color: blue; fill-color: blue; }

{ color: purple; fill-color: purple; }

{ color: red; fill-color: red; }

© OpenStreetMap contributors - licensed under CC BY-SA and derived from ODbl - https://www.openstreetmap.org/copyright © OpenStreetMap contributors

Other useful queries until today were locating nearby cellphone towers


or when moving to a new neighborhood a few pragmatic essentials: like post_box and recycling. Checkout the Key:amenity at OSM.


Update 08/2019

Later I found out about OpenStreetBrowser.org, offering a userfriendly and customizeable map-result view to Overpass API queries. Qwant started to have a map view offering OSM-based amenity tags too.