Loading OSM with OSMOSIS

Loading OSM with OSMOSIS

Now that I’ve decided to locally render OSM data for the campus, I need to get the OSM data for the maximum extent of campus areas into a local database (both Mapnik and I prefer Postgres). I initially tried doing this by using OSM2PGSQL, but that ultimately failed … not completely sure why.

Here are the steps I took to load this data into Postgres using OSMOSIS:

1. Download desired extent from OSM using JOSM … save the downloaded data as *.OSM2. Convert this .osm file to UTM8 encoding (e.g. using notepad++)3. Login to postgres, create a new database based on postgis template4. Run pgsql_simple_schema_0.6.sql, which is located in the osmosis install location in the ‘script’ directory5. Open a command line and run: PATH_TO_OSMOSIS_BATCH_FILE –read-xml file=”PATH_TO_OSM_FILE” –write-pgsql host=”HOST_NAME” database=”DB_NAME” user=”USER_NAME” password=”PASSWORD”, for example: C:qgis_projectsrenderosmosis-latest-binosmosis-0.32binosmosis.bat –read-xml file=”C:qgis_projectsrendernewark_josm_utm8.osm” –write-pgsql host=”localhost” database=”gis” user=”postgres” password=”mypassword”