Friday, 12 October 2018

postgresql - How to manage the osmosis command line?


This refer to this post : Read Here


I'm in trouble when using osmosis command line to export data from planet-latest.osm.bz2 directly to osm2pgsql using some criteria to select what to transfer.


I think is more easy to export planet-latest.osm.bz2 to an XML with osmosis and then use osm2pgsql to import to Postgre, but I can't go further. So I need help in osmosis parameters to show how can I to export data using filters like



--place='city' --admin_level='2'

and import to Postgre using osm2pgsql.


Sorry about this very similar post, but the user was helping me was gived up.



Answer



Firstly, you can download OSM extracts that are already filtered by country/region/city directly from CloudMade: http://downloads.cloudmade.com/


Secondly, the reason your command isn't working is because osm2pgsql requires a filename to be passed in. On Linux you would use /dev/stdin (and this is what the osm2pgsql docs tell you to do) but it looks like you're on Windows. Try the standard filename - used by most linux-native programs (from the source code it looks like this should work):


osmosis --read-pbf-fast south-america.osm.bz2 --node-key-value keyValueList="place.city,admin_level.2" --write-xml output.xml | osm2pgsql -c -s -d OSMTest -U postgres -H 10.5.112.210 -P 5432 -S ./default.style -

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...