[H-GEN] Extracting info from XML open street map file

Russell Stuart russell-humbug at stuart.id.au
Mon Jan 25 22:24:05 EST 2016


On Tue, 2016-01-26 at 01:10 +0000, mick wrote:
> 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 don't have clue how you went from the key/value format to osm2pgsql,
so more detail is required.  (None of the keys or values in your key/val
sample appear in the osm2pgsql sample, and I can't figure out where the
should appear.)

This sort of thing is usually best accomplished in a scripting language
of some sort - awk, lua, perl, php, python, even bash if it is simple
enough. I doubt it would be more than 10 lines, so if you post enough
detail someone will probably give you the script.



More information about the General mailing list