Difference between revisions of "AfricaEvents29November2008"
Line 157: | Line 157: | ||
shp2pgsql -I -s 4326 Dams.shp dams | psql workshop | shp2pgsql -I -s 4326 Dams.shp dams | psql workshop | ||
* Erk! What does that all mean? Lets break it down: | * Erk! What does that all mean? Lets break it down: | ||
− | + | /home/workshop/gisdata/za/brits/SAExplorer - go to our data directory | |
− | + | shp2pgsql - an application that loads shapefiles into a PostGIS database | |
− | + | -I - an option to shp2pgsql telling it to create a spatial index | |
− | + | -s - the coordinate reference system to use, expressed as an EPSG number. 4326 is the same as Lat/Long WGS84 | |
− | + | Damsp.shp - the filename of the shapefile to load | |
− | + | dams - the table name that the data should be loaded into | |
− | + | | psql workshop - send the results of the shp2pgsql into the psql application, workshop database | |
+ | * Lets take a peek inside our database now and see what we have | ||
+ | '''GRAEME GO ON FROM HERE USING PGADMIN III''' ? | ||
− | |||
− | |||
− | == | + | === Now you try! === |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Load''' the following layers (also from the /home/workshop/gisdata/za/brits/SAExplorer/ directory) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Hydrology_DWAFRivers.shp -> call the table 'rivers' | |
− | + | Transport_Mainroads.shp -> call the table 'roads' | |
− | + | RSATowns.shp -> call the table 'towns' | |
− | |||
− | |||
− | + | === What have I learned? === | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | * PostgreSQL is an enterprise ready relational database management system - and its Free and Open Source Software | ||
+ | * You can create a new database using the '''createdb''' command. | ||
+ | * '''PostGIS''' is a add on to PostgreSQL that lets you store spatial data and carry out spatial analysis within the database. | ||
+ | * In order to set up PostGIS you need to run a couple of SQL scripts | ||
+ | * '''shp2pgsql''' is a command line application that lets you load shapefiles into your spatial datastore | ||
+ | |||
+ | |||
+ | == Using PostGIS data from QGIS == | ||
+ | |||
+ | Once your data is in PostGIS, its easy to share across your organisation. Because it's in a database you get row level locking (instead of file locking in a shapefile), so many users can be editing and viewing data at the same time. There are many clients that let you visualise your PostGIS data..lets take a look at how we do it in QGIS. | ||
+ | |||
+ | * Open QGIS | ||
+ | * Start a new project | ||
+ | File -> New Project | ||
+ | * Add a PostGIS layer | ||
+ | Layer -> Add PostGIS Layer | ||
+ | * From the connections list, choose '''workshop''' | ||
+ | Click connect | ||
+ | * In the table list, click on '''dams''' | ||
+ | Click Add | ||
+ | |||
+ | === Now you try! === | ||
+ | |||
+ | * Add the following layers from your database | ||
+ | rivers | ||
+ | roads | ||
+ | towns | ||
+ | |||
+ | * set some nice colors for your layers - notice how the process is exactly the same as when setting colours for a shapefile. | ||
+ | |||
+ | * save your project into | ||
+ | |||
+ | /home/workshop/gisdata/brits_pg.qgs | ||
+ | |||
+ | |||
+ | === What have I learned? === | ||
+ | |||
+ | * You can '''visualise''' PostGIS spatial database tables inside QGIS | ||
+ | * To add a PostGIS layer, use the '''Layer -> Add PostGIS Layer''' menu option. | ||
+ | * Once a PostGIS layer, you can treat it just like any other (e.g. shapefile) layer | ||
+ | * Your presenters are truly amazing....however would I have figured this stuff out for my self :-) | ||
[[Category:Africa]] | [[Category:Africa]] |
Revision as of 02:33, 26 November 2008
What?
Our first OSGEO local chapter meet up! We will chew the cud, show you some cool stuff and start to get people familiar with the brilliant FOSS GeoSpatial products out there!
We'll go through installing some software and getting it to a point where you can have fun with it.
How Much?
There will be a door charge of R50 to cover costs & refreshments. That and an open mind are all you need to bring. If you're staying for the QGIS session in the afternoon you can bring your laptop (Windows, Linux or Mac!)
Where?
St Davids Marist Inanda College 36 Rivonia Rd Inanda Sandton
NB: We'll be in the Prep School computer lab.
When?
- November 29th
- Presentation and workshop segment: 9am to 12pm
- QGIS Bug Party! 12h30 onwards
Who
Your friendly presenters for the day will be:
- Tim Sutton (tim at linfiniti.com) - QGIS hacker and FOSS GIS junkie extraordinaire. Tim eats Weetbix for breakfast because it sounds like Linux. He once rewrote Nkosi Sikelela in C++ because he was feeling patriotic.
- Graeme McFerren - (graeme.mcferren at gmail.com) - GIS researcher and FOSS4G user. Mmm, aspire to be like Tim then.
- Gavin Fleming (gavinjfleming at gmail dot com) - I enjoy my daily FOSS4G fix and telling people how great it was. I'm a 'geoinformation scientist' at Mintek and love to see cutting edge and useful geospatial applications emerging.
- Brendon Wolff-Piggott - (brendon at integratedgeodata.co.za) - Water resources consultant and FOSS GIS enthusiast. I wish there were more hours in the day to keep up with FOSS4G!
RSVP
Let gavinjfleming at gmail dot com know if you're coming as numbers are limited.
Programme
- Be there in time for a 9am start
- Morning session: Introducing QGIS, PostGIS, GeoServer, uDig
- Afternoon session: QGIS Bug Party
QGIS Bug Party
As a preview release there are still various bugs that need resolving and various elements (e.g. translation) that may be incomplete. On Saturday the 29th in Johannesburg, South Africa, members from the Africa OSGEO chapter will be holding a QGIS Bug Hunt Party. We would like to invite people from around the world to virtually participate. Each person attending will get a free copy of QGIS 1.0.0 Preview 2 absolutely free of charge! Sorry no shrink wrap copies available. Preview 2 is the second in a series of preview releases we are making before we release the Stable QGIS 1.0.0 with long term support. We are going to great lengths to polish up QGIS 1.0 for you (inside and out) and we really appreciate all the feedback we have received thus far. Its virtually impossible to ship any software completely bug free, but with your help we can add just a little more shine to the polish! We need your help to:
- test on different machine configurations (bring your laptops!)
- validate existing bugs on each platform
- mark bugs that can no longer be replicated as ready for closure
- create new tickets for bugs that have not been reported yet (please search first to avoid posting duplicates!)
- mark bugs that are duplicates
- provide additional diagnostics so that developers can replicate issues
The idea is not to try to *fix* the bugs, but rather to do a QA session on the bugs in the bug tracker. In the process you will learn how to interact with an Open Source project the Right Way i.e. filing good quality bug reports.
I will start off with a simple show and tell covering:
- where to find the QGIS (and other OSGEO projects bug tracking sites)
- creating an account so you can file non-anonymous bugs and feedback on any OSGEO project bug tracker
- how the bug tracking system works - what the various input fields in the QGIS tracker mean
The approach will be to start by going through any bugs that have not been revised recently, adding additional status information. If you think the bug is fixed, add a comment:
Works for me now, recommend closure, <Your Name>
If you can replicate the bug, add a comment like:
Can replicate, OS: Ubuntu 8.10, QGIS Preview 2, <Your Name>
Use your initiative to deal with tickets that don't fit into the categories above, following a similar approach.
After that I will turn you loose on the queue and a shiny copy of QGIS preview 2 and let you have at it. Party is over when the last man falls asleep at the keyboard! Ok probably we will finish at between 4:30pm and 5pm if my wife has anything to do with it!
We look forward to seeing you at the QGIS Bug Party!!!
Workshop Notes
Welcome, introductions and overview
Lets make a map - First steps with QGIS
First we show you
- Open QGIS using the icon on the top Gnome Panel
- From the Layer menu, select Add Vector Layer
Layer -> Add Vector Layer
- A dialog box will appear
- Navigate to
/home/workshop/gisdata/za/brits/SAExplorer/
- Add the following layer:
Dams.shp
- Experiment with the map navigation toolbar to zoom in / out, pan, select etc features.
- Open the Layer properties dialog. There are several ways you can do this:
1) Select the layer in the legend and then from the menu do Layer -> Properties or 2) Right click on the layer in the legend and choose Properties from the context menu or 3) Double click on the layer in the legend
- Familiarise yourself with the various panels in the vector properties dialog.
- Select the Symbology tab
- From the Style Options panel, choose a please blue fill colour for your dams then
Click OK
- Use the zoom tool to zoom in to a dam and marvel at its stunning blue colour.
Now you try!
Add the following layers (also from the /home/workshop/gisdata/za/brits/SAExplorer/ directory)
Hydrology_DWAFRivers.shp Transport_Mainroads.shp RSATowns.shp
Zoom and pan around a little to explore your data Symbolise each layer with an appropriate colour to make the most awe inspring map.
Save your project using
File -> Save
And put it into
/home/workshop/gisdata/brits.qgs
What have I learned?
In ten minutes you now know how to add vector layers into QGIS, pan and zoom to navigate the map, set the colour of vectors using the Single Symbol option in the Layer Properties.
Shapefiles shmapefiles....real (wo)men store their data in PostGIS
- Create a new PostgreSQL database. To do this, open the terminal application (icon to the right of FireFox icon on the top menu bar). Now at the prompt type the following command:
createdb workshop
- Verify your database exists (once again type this into the console)
psql -l
- You should see something like this:
workshop@heron:~$ psql -l List of databases Name | Owner | Encoding -----------+----------+---------- postgres | postgres | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8 workshop | workshop | UTF8 (4 rows)
- Install the PostGIS spatial data extensions (again from the console). Hint copy and paste these from the IRC channel or the wiki page!
createlang plpgsql workshop psql workshop < /usr/share/postgresql-8.3-postgis/lwpostgis.sql psql workshop < /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
- Yegads! What did I just do? Firstly, you installed the plpgsql procedural language extensions into your PostgreSQL database. Then you ran two sql scripts which create the PostGIS spatial extensions to your database. You only need to do this once when you create a new spatial database, so don't worry about remembering those commands off by heart.
- Lets upload a shapefile into the database....once more into the black hole (console window).
cd /home/workshop/gisdata/za/brits/SAExplorer shp2pgsql -I -s 4326 Dams.shp dams | psql workshop
- Erk! What does that all mean? Lets break it down:
/home/workshop/gisdata/za/brits/SAExplorer - go to our data directory shp2pgsql - an application that loads shapefiles into a PostGIS database -I - an option to shp2pgsql telling it to create a spatial index -s - the coordinate reference system to use, expressed as an EPSG number. 4326 is the same as Lat/Long WGS84 Damsp.shp - the filename of the shapefile to load dams - the table name that the data should be loaded into | psql workshop - send the results of the shp2pgsql into the psql application, workshop database
- Lets take a peek inside our database now and see what we have
GRAEME GO ON FROM HERE USING PGADMIN III ?
Now you try!
Load the following layers (also from the /home/workshop/gisdata/za/brits/SAExplorer/ directory)
Hydrology_DWAFRivers.shp -> call the table 'rivers' Transport_Mainroads.shp -> call the table 'roads' RSATowns.shp -> call the table 'towns'
What have I learned?
- PostgreSQL is an enterprise ready relational database management system - and its Free and Open Source Software
- You can create a new database using the createdb command.
- PostGIS is a add on to PostgreSQL that lets you store spatial data and carry out spatial analysis within the database.
- In order to set up PostGIS you need to run a couple of SQL scripts
- shp2pgsql is a command line application that lets you load shapefiles into your spatial datastore
Using PostGIS data from QGIS
Once your data is in PostGIS, its easy to share across your organisation. Because it's in a database you get row level locking (instead of file locking in a shapefile), so many users can be editing and viewing data at the same time. There are many clients that let you visualise your PostGIS data..lets take a look at how we do it in QGIS.
- Open QGIS
- Start a new project
File -> New Project
- Add a PostGIS layer
Layer -> Add PostGIS Layer
- From the connections list, choose workshop
Click connect
- In the table list, click on dams
Click Add
Now you try!
- Add the following layers from your database
rivers roads towns
- set some nice colors for your layers - notice how the process is exactly the same as when setting colours for a shapefile.
- save your project into
/home/workshop/gisdata/brits_pg.qgs
What have I learned?
- You can visualise PostGIS spatial database tables inside QGIS
- To add a PostGIS layer, use the Layer -> Add PostGIS Layer menu option.
- Once a PostGIS layer, you can treat it just like any other (e.g. shapefile) layer
- Your presenters are truly amazing....however would I have figured this stuff out for my self :-)