Day 2 - Loading OSM Data to Database
Loading your OSM Data for Students of planning course run by Fingal County Council in Maseru 09/02/2015
Requirements
- Must have OpenGeo Suite Installed - Download OpenGeoSuite
- QGIS Installed - Download QGIS
- Have a copy of lesotho_osm1.tar file from Colin
Contents
- Open PgAdmin
- Open PostGIS Database
- Create Lesotho Database
- Load in data from tar file
- Extra Resources
Open PgAdmin
Go to the start menu and look for OpenGeoSuite 3.x. Under this group you will find PgAdmin. Click this to open it.
Open PostGIS Database
Double click on PostGIS database on the left.
Next a prompt will show asking for a password.
You should then enter whatever the password is for your normal windows login. Then click OK.
Create Lesotho Database
CREATE DATABASE lesotho;
Right click on the Databases. Then click New Database.
Enter lesotho as the name for the new database and click OK.
Now click on the lesotho database to load it up.
Click on SQL button in the top bar.
Type in the following to window that is now open.
CREATE EXTENSION postgis;
You must then click the Execute Query button at the top. When the query has finished running it looks like the image below.
Load in data from tar file
Now in this step we need to make sure we have a copy of the lesotho_osm1.tar
file on our computer. This is required for the next few actions.
Close the SQL Query window. When prompted to save the query, Click NO.
Next right click on the lesotho database and choose **Restore **from the menu.
This window will open. Now click the ...
and locate the lesotho_osm1.tar
file. When you have selected the file click ok.
Now click Restore. This will take a few minutes before the query finishes.
When this finishes click the X to close the window. Now go to the tables section under the lesotho database (lesotho => Schemas => public => tables). You should now have the same tables as below:
Congratulations you now have your OSM data in a database which you can use with QGIS.
Extra Resources
- An Introduction Course to OpenGeo Suite. This will introduce you to the different tools which come with this package and how you can use them to serve up a web map
- Introduction to PostGIS. This course will show you each of the geospatial functions that are part of PostGIS and how you can use them under different scenarios