In this note I try install PostgreSQL, PostGIS and osmosis on a Windows machine.

There is an old and very helpful tutorial on how to do this at

https://www.r-spatial.org/2017/07/14/large_scale_osm_in_r

I will refer to this as the tutorial.

However this tutorial is a bit dated so instead I googled for installation of PostgreSQL which lead me to the following site

https://www.postgresql.org/download/windows/

For the installation procedure I simply follow all the default steps and I write down password and port.

Having installed PostgreSQL simply follow the instructions here

http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01

in order to install PostGIS.

Finally as mentioned in the tutorial I had to install osmosis. I followed the link in the tutorial, which lead me to this wiki site

https://wiki.openstreetmap.org/wiki/Osmosis

where I choose the link for downloading the latest stable version

https://github.com/openstreetmap/osmosis/releases/latest

as a zip-folder. I then unpacked this folder on my desktop naming the topfolder “osmosis”. This folder I then mooved to the location “C:/users/programs (x86)”. Inside the folder “C:/users/programs (x86)/osmosis/bin” there is a file called “osmosis.bat” which I double clicked.

The installation procedure is also described here

https://wiki.openstreetmap.org/wiki/Osmosis/Quick_Install_(Windows)

however the textfile one is asked to create is simply the above file called “osmosis.bat” so such a textfile need not be created.

Next I change my pathvariable adding osmosis. To find where to set the path variable. If you do not know how to do this I suggest you search youtube and find a video instruction for doing this. Simply search youtube for “windows 10 path variable”. Another option is to follow this helpful tutorial

https://learnosm.org/en/osm-data/osmosis/

Because I named the folder where osmosis is “C:/users/programs (x86)/osmosis” the path variable should simply be “C:/users/programs (x86)/osmosis/bin” pointing to the bin-folder.

Having set the path variable it is a good idea to restart the computer.

Then go to the command line. Simple choose search and write cmd as is described in this tutorial

https://learnosm.org/en/osm-data/osmosis/

then simply write “osmosis” without the citation and press return. If you get messages as described in the above tutorial it should be working. Then follow the above tutorial and test if osmosis works using the excute

osmosis –rbf sample_osmosis.osm.pbf –nkv keyValueList=“amenity.school” –wx schools.osm

and check if schools.osm is generated.

Finally return to the tutorial

https://www.r-spatial.org/2017/07/14/large_scale_osm_in_r

and complete the steps described there.

Finally when I tested the connection I got the return value FALSE, so I naturally thought the connection was not established however I see this usefull post

https://stackoverflow.com/questions/40642657/connecting-r-to-postgresql-database

which tells you to do execute dbListTables(connection) in R and all my tables were there. So success.