You are viewing an old version of this page. View the current version.
Welcome to the home page for the NIWA QGIS User Group. This is a publicly readable web page hosted by NIWA to support users of QGIS, particularly within NIWA, but any QGIS user is welcome!
Why are we here? Based on the understanding that the benefits from any Open Data initiative revolve around data mash-ups and re-use, providing access to a tool allowing people (including NIWA staff) to use all this free environmental data is an important part of any such initiative. QGIS is a core part of NIWA's information delivery strategy - for NIWA staff as well many of our other clients.
Much like the development of easily used and affordable word processing & spreadsheet software for personal computers enabled pretty much anyone to carry out what used to be specialised tasks, freely available desktop mapping and GIS software are enabling their democratisation and widespread general use. Note that we do not envisage QGIS as necessarily meeting all the needs of all GIS users, but NIWA and many other agencies in New Zealand and globally, are adopting tools like QGIS to enable more widespread use of institutional GIS resources, without the traditional expense associated with commercial GIS software.
So, here we are!
Time for next meeting - THIS WEEK:
When: Wed 29 July, 11:30, NIWA Wellington Brodie Boardroom
Topic: Getting & plotting Antarctic data & NIC species observations
Abstract: Plotting polar maps as demonstrated here covers several topics:
- getting Antarctic coast & ice shelf data (and polar front if required) via WFS and saving as a local shapefiles
- creating a custom polar projection to show the data how we want (NZ up, not down)
- getting CCAMLR SSRU management area polygon data
- connecting to the NIC Specify database to view specimen locations
- plotting with lat/long annotations on polar map
Remember to regularly save your project as you work - so you can keep the work you have done to reload when (not if!) you make a mistake.
The NSIDC layers are available in a few CRS's - we will start with EPSG:3031, Antarctic Polar Stereographic. In QGIS, set the default CRS to this (EPSG:3031 WGS/84 Antarctic Polar Sterographic) using Settings -> Options -> CRS
The data for the Antarctic coastline, islands and ice shelf (for this demonstration) is retrieved from the NSIDC (US National Snow and Ice Data Centre) Atlas of the Cryosphere. It is provided via WFS/WMS services which can be accessed using QGIS. Details on the services are at: http://nsidc.org/data/atlas/ogc_services.html We want the actual data, not a map of the data, so we will
You can connect to the service in QGIS using the browser, the layer toolbar or the main menu, as you prefer. These notes use the main menu. Choose Layer -> Add Layer -> Add WFS layer and click New
Name the new datasource something appropriate - like NSIDC Cryosphere, and the URL: http://nsidc.org/cgi-bin/atlas_south?
Save and connect. You will get a list of the available datasets, each of which can be selected and loaded as a new layer into QGIS. You can add any of these you like, this demonstartion will use 5:
- Antarctic ice shelves
- Antatctic continent
- Antarctic islands
- Coastlines (excluding Antarctica)
- Antarctic Polar front
You can select all these in a single operation, by using CTRL-click on each layer, then the Add button. QGIS will connect to NSIDC and download each dataset. This can take a couple of minutes, depending on your network connection. If you get a timeout error, use Settings -> Options -> Network to set the default timeout for network requests to 180000 (3 minutes) which should be enough for most cases. Move the layers up/down until the order makes sense & change colours/styles as you prefer.
You should now have a QGIS Antarctic map, but the Polar Stereographic projection is centred on the pole, so all directions are north - and the "up" direction on the map is 0o, which puts 180o down - along with the Ross Sea and New Zealand. We will now create a new custom projection, based on the Antarctic Polar Stereographic one, but with 180o up.
Parameters for Antarctic Polar Stereographic CRS: +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
Choose Settings -> Custom CRS, click the green + button to add a new CRS. Click the right button to copy an existing CRS, Enter 3031 as a filter and choose WGS84 / Antarctic Polar Sereographic. Click OK to copy the parameters into the new CRS Parameters pane, and give the new CRS a relevant name, eg: NZ polar. You now need to edit the parameters to create the NZ up version. Change +lon_0=0 to +lon_0=180 to switch from 0o up to 180o up and save.
Now tell QGIS to use this CRS: Project -> Project Properties -> CRS. Enable "On the fly transformations" and enter NZ as a filter, then choose the new CRS as the project CRS. QGIS will now plot the map using this 180o up polar projection, and automatically reproject layers in other CRS's to this one for viewing on the map.
You should now have your Antarctic map looking correct for zooming in to the Ross Sea/New Zealand. Zoom in to the region of interest.
We will now save each of the NSIDC layers as a local shapefile, ready to re-use whenever needed. For each layer, right-click and choose "Save as". Ensure the format is "ESRI Shapefile", give it a suitable name & location and save it. You can keep the original EPSG:3031 Polar Stereographic CRS.
This is a very good time to save the project!
We will now download a copy of the Antarctic SSRU polygons from the CCAMLR website. If you want other CCAMLR datasets, grab them as well. In a web browser, connect to http://gis.ccamlr.org Click the Download button in the bottom left. This provides access to a wide range of Antarctic datasets, including the NSIDC ones. (For Antarctic biodata - also see the SCAR-MarBIN ANTABIF data portal at http://data.biodiversity.aq/). On the CCAMLR website, choose the Product: Management areas->SSRU's, choose Full dataset for Area of interest, and ESRI Shapefile format, then click Get to download, and unzip the zipped shapefile, then open in QGIS as a vector layer. Label this with ssrucode and style as desrired.
We now have a pretty full map of the region, so will now get some NIWA data to display on the map. This example is using the "virtual datasource" capability of QGIS. This entails creating an XML file which contains information:
- where to get the data (type of database, server, database name and user details)
- an SQL format query to retrieve the desired data
- instructions on how to derive a geometry feature from these data.
The XML file we are using connects to the underlying NIC Specify database, which is a MySQL database, with columns of latitudes and longitudes in decimal degrees. The password can be provided on request, if you require access.
<SrcSQL>select catalognumber, latitude1 AS y, case when longitude1 > 180 then -360+longitude1 else longitude1 end AS x,localityName as StationID, startDate, latitude1, longitude1, latitude2, longitude2,
maxElevation, minElevation, taxon.fullname as TaxonName, prefT.fullname as PreferredName from collectionobject INNER JOIN collectingevent ON collectionobject.collectingeventid = collectingevent.collectingeventid
INNER JOIN locality on collectingevent.localityid = locality.localityid LEFT JOIN determination on collectionobject.collectionobjectid = determination.collectionobjectid
LEFT JOIN taxon on determination.taxonid = taxon.taxonid
LEFT JOIN taxon prefT on determination.preferredtaxonid = prefT.taxonid
WHERE Latitude1 is not null and longitude1 is not null and determination.iscurrent = 1 and catalognumber is not null
ORDER BY Catalognumber</SrcSQL>
<GeometryField encoding="PointFromColumns" x="x" y="y"/>
This is a virtual data source, as the file QGIS connects to does not contain the actual data, just pointers to the data. The most complicated part of this is the SQL query which requests the required content from the underlying tables in the Specify database. This example will return all longitudes in a +-180 space, so that a value of 185 will be automatically provided as -175. QGIS will automatically reproject these to the new custom CRS using the parameters defining it.
Edit this file to enter the correct password, save and open as a QGIS vector layer (type = VRT - Virtual Data Source). It should only take a few seconds to retrieve and plot the 96,000 records. You can use the usual query builder and style editor to select which records are displayed, and how they look in the map.
The last part of this exercise is to create a printable map from this using the QGIS print composer. While the map is plotted in Antarctic Polar Stereographic meter coordinates, our labels and ticks will be in decimal degrees. Open a new composer and add the map to the page. The next steps are about adding a frame and annotated lat/long grids. In the print composers's "Item properties", open the "Grid" tool, and click the green + to add a new grid. This is "Grid 1" and will be the plain frame around the map.
- set Grid type to "Frame and annotations only"
- set grid CRS to EPSG:4326
- set frame style to "Line border"
Sroll back up the "Item properties" and add a second grid (Grid 2) which will contain the grid with labelled ticks. The settings for this gird are:
- set Grid type to "Solid"
- set grid CRS to EPSG:4326"
- set frame style to "Exterior ticks"
- set frame size to 2.0mm
- set X and Y intervals to 10.0
- set Left divisions to "Latitude(Y) only"
- set Top divisions to "Longitude (X) only"
- un-tick Bottom and Right sides
- turn on "Draw coordinates"
- set Format to "Decimal with suffix"
- set Left to "Latitude only", "Outside frame" and either "horizontal" or "vertical" as you prefer
- set Right to Disabled
- set Top to "Longitude only", "Outside frame" and "Horizontal"
- set Bottom to "Disabled"
- set Coordinate precision to 0
- save as an image
- crop as desired (GIMP, etc)
You should have a map looking something like this:
2014 report comparing ArcGIS with QGIS
Accessing MPI research trawl data with QGIS
Abstract: NIWA manages several research databases for MPI Fisheries, which QGIS can be used to access. This demonstration will show how QGIS can be used to access & display research trawl survey data, eg:
- one (or more) species from all trips
- selected species from a particular trip
- symbols sized by catch size
- trawls with zero catch of a species
- survey strata boundaries
These data can be overlaid with topo maps or marine charts, freely downloadable from LINZ.
Anyone familiar with the trawl data, stratified surveys or pretty much any species observation/distribution data should find this useful and relatively easy. The trawl database has several decades of species catch data, which can be accessed and viewed.
An additional feature is the use of the QGIS Action tool (originally developed by Gavin Macaulay of NIWA) to retrieve catch data from the database by clicking on a station on the map - this is particularly useful as it allows users to retrieve non-spatial data reference to a point on a map - the catch data (and underlying catch database table) contains no position data, but can still be retrieved in QGIS.
The demonstration is based around this pdf document - a How-To guide to access research trawl data.
Click to view for a more detailed view of Landcare Research's freely available NZ basemap! (internet mapping with QGIS)
Please feel free to add comments & suggestions.
Questions can go here, but the mailing list is preferable.
If anyone wants to help manage these wiki pages, please let me know!!!
Frequently asked questions
Need more help?
- Email Brent directly at [email protected]
- Browse or search the online QGIS manual
- DMS NZ Postgis training notes
- DMS QGIS Introductory course notes
- Malcolm Hutchinson's QGIS page
- NZ ECO's eLearning GIS page
- NIWA Quantum Map
- Digital Mapping Solutions New Zealand
- OSGeo web site for other free GIS related tools and applications
- NZ GIS in Conservation Society
- James Sturman's list of WxS services (NIWA internal wiki)
- OpenGeo's Introduction to Postgis workshop
- OpenGEO's spatial databases tips and tricks workshop
- NIWA Postgis workshop notes
- NIWA GMT workshop notes
- NIWA Postgis-GMT-mapserver scripting notes
- A free (Q)GIS package for Antarctica
- Ujaval Gandhi's QGIS Tutorials and Tips
- How to use LINZ Data Service WMTS background layers with QGIS
Browse by topic
Recently updated articles
Browse by topic
Recently updated articles
- No labels