osm2shp - convert an osm|pbf file to a set of shapefiles using ogr2ogr. Filtering with tags is controlled by a .ini file.
Usage:
osm2shp.py [-h][-c configfile] -O my_osm_file.osm|pbf -o outputdir
-O osm_file - the osm|pbf file
-o outputdir - the directory to store the output in
-h - show this information
-c configfile (default is osm2shp.ini)
-M maxproc - maximum number of ogr2ogr processes to start (default = 2)
- ogr2ogr (tested with gdal >= 1.10.0)
- the OSM_CONFIG_FILE environment var should be set and point to a valid gdal osmconf.ini file
The ini file has a section for each shape file created:
[lu_roads_sec] type=lines highway=motorway_link,secondary,"road" aeroway='runway','taxiway' [lu_roads_main] type=lines highway='motorway','trunk','primary' [lu_roads_small] type=lines highway='footway','path','pedestrian','residential','service','tertiary','track','unclassified','cycleway' [lu_water] type=multipolygons natural='water','reservoir','basin','salt_pond' landuse='water','basin','reservoir','salt_pond'
$Author: $ $Id: $ $Rev: $
Gets a string from a config file (.ini) and returns a default value if the key is not found. If the key is not found it also sets the value with the default in the config-file
Sets a string in the in memory representation of the config object Deos NOT overwrite existing values if overwrite is set to False (default)
http://stackoverflow.com/questions/4992400/running-several-system-commands-in-parallel
Reads .ini file and sets default values if not present
Main function, processes the command-line options, reads the config file and starts the extract function.
Create the ogr2ogr string from a ini file to select data using sql statements - one statement for each section - multiple tags per feature using a comma separated list