Can't login? ... use the Forgotten your password? link at um.niwa.co.nz
Child pages
  • Accessing NSIDC data services, CCAMLR data and Specify specimen locations.
Skip to end of metadata
Go to start of metadata

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 create a local copy of these data.

You can connect to the WFS ervice in QGIS using the browser, the layer toolbar or the main menu, as you prefer. These notes use the main menu approach. Choose Layer -> Add Layer -> Add WFS layer and click New

Name the new datasource something appropriate - like NSIDC Cryosphere, and add 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 demonstration 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 term, then choose the new CRS you just created 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 good 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.

NOTE: 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. The example used here uses the "virtual datasource" capability of QGIS. This entails creating an XML file which contains information:

  1. where to get the data (type of database, server, database name and user details)
  2. an SQL format query to retrieve the desired data from the database
  3. instructions on how to derive a geometry feature from these data.

The XML file we are using connects to the NIWA NIC Specify database, which is a MySQL database under the hood, with columns of latitudes and longitudes in decimal degrees for specimen locations. Access details can be provided on request, if you require them. This is not a public database, but NIWA staff can contact Sadie Mills to discuss such access. Note that you can access public records from this database using the IPT plugin for QGIS to access GBIF data, as NIWA submits publicly available species records to OBIS and GBIF global databases. The file is shown here both as a specific example in this use case, but also as a more general example of how QGIS can be used like this to directly access and interact with already existing non-spatial databases, providing a GIS/map based access to data where perhaps this was never considered previously.

<OGRVRTDataSource>
  <OGRVRTLayer name="collectionObjects">
    <SrcDataSource>MYSQL:XXXXXXXXXX,user=XXXXXXXXX,password=XXXXXXXXXX,host=XXXXXXXXXXX,port=3306</SrcDataSource>
    <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>
    <GeometryType>wkbPoint</GeometryType>
    <GeometryField encoding="PointFromColumns" x="x" y="y"/>
    <LayerSRS>EPSG:4326</LayerSRS>
  </OGRVRTLayer>
</OGRVRTDataSource>

This is a virtual data source, as the file QGIS connects to does not contain the actual data, just pointers to where QGIS can get 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 predefined parameters.

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 print composer and add the map to the page (you can work out how :-). 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"

Scroll 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, or other image editors) or using the crop tool in the print composer (created just for NIWA!)

You should have a map looking something like this:

 

  • No labels