Finally pulling data out of OSM

Nov 5, 2021 | GIS, Open Street Map

……as opposed to pushing data into OSM.

So I’ve been working on a OpenStreetMap workshop for URISA. I had originally written it 6 or 7 years ago and it’s been touched in spots but not “re-written”. I am doing a top to bottom shakedown of the workshop and fixing slides and adding new information. It’s been like opening a time capsule of sorts of what has changed and what hasn’t changed in OSM/My Life over the last 7 years.

What does this have to do with anything?

When I had last touched the workshop I’m not 100% sure that Overpass was a thing. I know there was a tool to extract OSM data into QGIS and there was a tool in ArcMap to pull down data. You could always download a planet file or use JOSM to download data.

Over the last few years I became aware of overpass but hadn’t used it. I decided to dig into it just a bit for the benefit of the workshop. Overpass lets you specify tags (or attributes) and run that query against the OSM data. You can then download it. Of course you need to be gentle – running a large area with a lot of data will timeout – you’re better off grabbing a OSM file from Geofabrik and processing that.

As of late I’ve gotten fascinated by fire hydrants in OSM – so I ran a query of just TN for Fire hydrants. For the record there are 837 fire hydrants in and around TN. I posted the Overpass query below:

[out:xml][timeout:25];
// gather results
(
  // query part for: “amenity=fire_hydrant”
  node["emergency"="fire_hydrant"](35.00208, -90.34742, 36.61557, -81.64104);
);
// print results
out body;
>;
out skel qt;

So what? Well – now that I have this query written I can actually send it to overpass by command line:

wget -O output.osm --post-file=firehydrant.osm "https://overpass-api.de/api/interpreter"

I can now grab OSM data when I want it (within reason). I could set up a script to run once a week or month and see what has changed.

How does this fit into my favorite piece of software? QGIS has a plugin called QuickOSM .

QuickOSM is leveraging overpass to grab data. I can use place names like Chattanooga to constrain my download. I can specify my overpass file from above and use that. It will even let you parse a OSM file and extract data from that.

Anyway – it was a fun hour of killing time and pulling data out of OSM vs putting data into OSM. Plus if OSM is all you have – the Quick OSM plugin makes it easy to leverage that data to create a map.

You may also like

FOSS4G Nashville 2022

For Posterity - here is the schedule for the FOSS4G event In Nashville. It's weird - I finally did some digging and this is the 4th Event I've run. We did one other meeting in Huntsville that I was half way involved in. We were talking last night at Jackelope Brewing...

ESRI’s File Based Geodatabase and QGIS

With QGIS 3.28.1 being released you get this one new thing that I thought I'd never see. Way back in June (2022) this popped up on twitter: Yes - GDAL 3.6 would have the ability to edit ESRI File Based Geodatabases. Back in 2014 GDAL gained the ability to read an ESRI...

Advertising and the Great Tweet

Business. It's complicated. One of the more complicated things I've done has been advertising. How do you advertise a small GIS Consulting Shop? Ads on "The Internet"? Magazine? Direct Mailings? Word of mouth? The answer is "word of mouth". That and Conferences. That...