Command to filter the file with tag amenity=school and write the filtered data in second file.
$ osmosis –read-xml file=”ludhiana.osm” –nkv keyValueList=”amenity.school” –write-xml file=”school.osm”
Do you want to update your OSM data without deleting existing data?
So here are the steps given below.
Derive a change set between two files. The first file is the file after changing, the second planet file is the file before changing. The changeset will be written in the third file.
$ osmosis –read-xml file=”classroom.osm” –read-xml file=”class_lib_tcc.osm” –derive-change –write-xml-change file=”classroom_classlibtcc_diff.osm”
Dump the changeset to the database in append mode. It means it will change only affected data. Rest will exist there.
$ osm2pgsql –slim -a -d classroom -C 2500 –hstore -S openstreetmap-carto.style ~/osmosis_files/class_audi_diff.osm
And you are done.:)
Note: Osmosis and osm2pgsql have different schemas. So for using postgis flags of osmosis we have to create schema compatible with osmosis. I followed this link to create ans setup database.
For my satisfaction, I have written that command again.
$ psql -d classroom -f /home/amisha/osm/osmosis/script/pgsnapshot_schema_0.6_action.sql