Skip to content

Find fire stations in OpenStreetMap using Overpass Turbo

My kid got a new project: find fire stations. Google Maps is not really helpful here, obviously. And searching in the OpenStreetMap web interface is also a lot of work. But Overpass Turbo is able to find all the places.

 

When you open the Overpass Turbo page, it starts in Rome, Italy, at the Colloseum. That's nice, but likely not the place you are looking for. Either scroll to the area you are interested in, or use the search function.

The left side of Overpass Turbo is the input field. You draft queries in a specific language, named Overpass QL. Once you hit the "Run" button, the right side of the window either shows you the map, or the data output.

The QL has a couple options, but let's start with the basics. I moved the map to Berlin, Germany, near the Brandenburg Gate and Alexanderplatz. Then I started with this simple query:

(
  node [amenity=fire_station]({{bbox}});
);
out body;

The result is visible using this link. One can see 5 different results, in 4 different areas of the city. Near Friedrichshain apparently there are two circles close together, something to investigate and see what is wrong there. The {{bbox}} limits the results to the currently visible map box.

But let's verify the results further. Scrolling the map to Berlin Frohnau, where I know a fire station. When I run the query again, the map is empty. That's ... unexpected. The fire station is clearly on the map. But it's not a node, it's a way. Which means I should not only search for nodes, but also for ways and relations. Let's expand the query:

(
  node [amenity=fire_station]({{bbox}});
  way [amenity=fire_station]({{bbox}});
  relation [amenity=fire_station]({{bbox}});
);
out body;
>;
out skel qt;

In OpenStreetMap, only nodes have coordinates. Ways and relations are made up of polylines and areas (groups or collections of nodes respective points). The extended syntax in the above example shows the output on the map. The result includes the known fire station - success.

But it does not look nice. Fire stations are red, not Overpass blue. The result can be formatted. For this, a {{style}} can be added:

{{style:
way{
  color: red;
  fill-color: red;
  text: name:en;
}
node{
  color: red;
  fill-color: red;
  text: name:en;
}
relation{
  color: red;
  fill-color: red;
  text: name:en;
}
relation node, relation way, relation relation {
  color: red;
  fill-color: red;
}
}}

Ways, nodes and relations are formatted red, and filled red. Also the english name is picked (which should be available in many cases). The new query:

(
  node [amenity=fire_station]({{bbox}});
  way [amenity=fire_station]({{bbox}});
  relation [amenity=fire_station]({{bbox}});
);
out body;
>;
out skel qt;

{{style:
way{
  color: red;
  fill-color: red;
  text: name:en;
}
node{
  color: red;
  fill-color: red;
  text: name:en;
}
relation{
  color: red;
  fill-color: red;
  text: name:en;
}
relation node, relation way, relation relation {
  color: red;
  fill-color: red;
}
}}

All fire stations - no matter which type - are red now. Looks much more recognizable now.

Last but not least a bit of maintenance, one can specify a timeout which tells Overpass Turbo to abort the query if it runs too long. It's useful to always include this parameter, and avoid overloading the server if the result set is becoming too big.

[out:json][timeout:25];

The entire query now:

[out:json][timeout:25];
(
  node [amenity=fire_station]({{bbox}});
  way [amenity=fire_station]({{bbox}});
  relation [amenity=fire_station]({{bbox}});
);
out body;
>;
out skel qt;

{{style:
way{
  color: red;
  fill-color: red;
  text: name:en;
}
node{
  color: red;
  fill-color: red;
  text: name:en;
}
relation{
  color: red;
  fill-color: red;
  text: name:en;
}
relation node, relation way, relation relation {
  color: red;
  fill-color: red;
}
}}

And the result for Berlin. That's quite a number of fire stations there, and good input for the project!

And next time I try to extract the data in a way which can be imported into other programs. Only the nodes have address data and coordinates, would be nice if Overpass can somehow export that for all results.

  • Twitter
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Find fire stations in OpenStreetMap using Overpass Turbo
  • Bloglines Find fire stations in OpenStreetMap using Overpass Turbo
  • Technorati Find fire stations in OpenStreetMap using Overpass Turbo
  • Fark this: Find fire stations in OpenStreetMap using Overpass Turbo
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at YahooMyWeb
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at Furl.net
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at reddit.com
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at blinklist.com
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at Spurl.net
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at Simpy.com
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo at blogmarks
  • Bookmark Find fire stations in OpenStreetMap using Overpass Turbo with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options