[OSM-dev] Extracting info from XML open street map file

mick bareman at tpg.com.au
Tue Jan 26 01:10:06 UTC 2016

I've been struggling for a few years, on and off to extract useable subsets from open streetmap files with very limited success. osm2pgsql produces the best results but depends on knowing all the keys in the input file.

I have grep'd and sort -u the input to produce a list of unique key/value tags (2.1 million of them). The next step is to process that list into an osm2psql style file but I can't think how to automate that process.

Generic key/value lines:
		<tag k="107" v="96"/>
		<tag k="1744_field_ref" v="143"/>
		<tag k="1744_field_ref" v="94"/>
		<tag k="1860name" v="Aberargie Mill (Corn & Flour)"/>

osm2pgsql style:
node,way   building     text         polygon
node       capital      text         delete	#linear
node,way   construction text         delete	#linear

I've spent the last 3 days doing it manually but only got about 10% into it and am at the stage where I keep making mistakes.

Can sks please give me a few pointers on the nifty *nix utilities that can work some magic on this process.

mick in glen innes

More information about the dev mailing list