Map feeds
Trap.NZ provides a range of map feeds in OGC (Open Geospatial Consortium) formats which can be linked directly into GIS tools such as ArcGIS, Google Earth and Google Maps, QuantumGIS etc.
To access the feeds you first need to generate an API key.
- Generating an API key
- Accessing map feeds
- Trap records map feed attributes
- Downloading shape files, CSV, linking into Google Earth etc
- Accessing the Trap.NZ map feeds with QGIS
- Accessing the Trap.NZ map feeds with ArcGIS
- Attributions
Generating an API key
In the My account section of Trap.NZ, you can generate an API key that’s associated with your user account. It can only be used for map feeds (which are read-only), and it can be changed any time by generating a new key, which will disable any previously used keys.
Accessing map feeds
Map feed addresses are in the format:https://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id
and https://io.trap.nz/geo/trapnz-projects/wms/apikey/project_id
for WFS and WMS feeds respectively.
The Project ID is the last part of the URL when you select your project in Trap.NZ.
i.e. when you select the project after logging in, the URL will look something like https://trap.nz/node/123456
, and in this case, the Project ID will be 123456.
Note: Some of the map feeds apply to all the projects you are a member of. If you are using those feeds, you still need to select a default project. It doesn’t matter which one.
So for a test user and project the WFS feed looks like this:https://io.trap.nz/geo/trapnz-projects/wfs/35GElj7FEyGB-gpalO5ptgcEjxmNe7QzOiJNbEPZmSU/123456
(you must generate your own key under the My Account section of the Trap.NZ website)
You can paste these URLs into your GIS system and it will show you the available layers.
The layers currently available are:
- my-projects
The project polygons and metadata from the Trap.NZ projects you have access to - my-projects-lines
All the lines from the Trap.NZ projects you have access to - my-projects-traps
All traps from the Trap.NZ projects you have access to - my-projects-trap-records
All trap records from the Trap.NZ projects you have access to - my-projects-bait-stations
All bait stations from the Trap.NZ projects you have access to - my-projects-bait-station-records
All bait station records from the Trap.NZ projects you have access to - my-projects-monitoring-stations
All monitoring stations from the Trap.NZ projects you have access to - my-projects-monitoring-station-records
All monitoring stations from the Trap.NZ projects you have access to (excluding 5 minute bird counts and camera trap records) - my-projects-pois
All points of interest from the Trap.NZ projects you have access to - default-project
The project polygon and metadata from the project specified in the URL - default-project-lines
All lines from the Trap.NZ project specified in the URL - default-project-traps
All traps from the Trap.NZ project specified in the URL - default-project-trap-records
All trap records from the Trap.NZ project specified in the URL - default-project-bait-stations
All bait stations from the Trap.NZ project specified in the URL - default-project-bait-station-records
All bait station records from the Trap.NZ project specified in the URL - default-project-monitoring-stations
All monitoring stations from the Trap.NZ project specified in the URL - default-project-monitoring-station-records
All monitoring station records from the Trap.NZ project specified in the URL (excluding 5 minute bird counts and camera trap records) - default-project-pois
All points of interest from the Trap.NZ project specified in the URL
Notes
- More map feeds will be added over time (e.g. 5 min bird count and camera trap records)
- The WFS server is set to return a maximum of 10k features per page request. Therefore you must set a page size value smaller than that. We suggest 5k to begin with.
- Map feeds are updated overnight - they won't contain records or installations added today.
Trap records map feed attributes
Fields returned
Field |
Description |
record_id |
the trap record UID |
project_id |
project number |
project |
project name |
line |
line name that the trap is associated with |
trap_code |
the trap code or name |
trap_type |
the trap type (e.g. DOC 200, A24, etc.) |
trap_status |
status of the trap when checked |
trap_condition |
condition of the trap |
rebaited |
whether the trap was rebaited or not |
bait_at_arrival |
bait from the previous record (comma delimited if multiple) |
bait_details_at_arrival |
any bait details from the previous record |
bait_at_departure |
bait set with the trap record (comma delimited if multiple) |
bait_details_at_departure |
any bait details set with the trap record |
strikes |
strike count - for self-resetting traps this would be the number of times it has gone off since the last check. For conventional traps, this would be 1 if sprung. |
species_caught |
species name |
gender |
species sex if recorded |
maturity |
species maturity if recorded (juvenile/mature) |
record_date |
date of record |
recorded_by |
name of person who made the record |
record_notes |
record notes |
prev_record_date |
date of the previous record |
next_record_date |
date of the next record |
corrected_nights_from_prev_record |
RTC calculation (number of trap nights) from the previous record date |
corrected_nights_to_next_record |
RTC calculation (number of trap nights) to the next record date |
Downloading shape files, CSV, linking into Google Earth etc
The map server allows access to WGS 84 and NZTM projections and can also output in many different formats with:
https://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id?service=WFS&version=1.0.0&request=GetFeature&typeName=layer&outputFormat=format
Output formats:
GML2 |
|
GML3 |
|
Shapefile |
|
JSON |
|
JSONP |
|
CSV |
|
e.g. to get a shapefile of trap locations:
https://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id?service=WFS&version=1.0.0&request=GetFeature&typeName=trapnz-projects:my-projects-traps&outputFormat=shape-zip
KML (you can link this directly into Google Earth):
https://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id?service=WFS&version=2.0.0&request=GetFeature&typeName=trapnz-projects:my-projects-traps&outputFormat=application/vnd.google-earth.kml+xml
CSV:
https://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id?service=WFS&version=2.0.0&request=GetFeature&typeName=trapnz-projects:my-projects-traps&outputFormat=csv
You can also view features directly in OpenLayers:
https://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id?service=WMS&version=1.1.0&request=GetMap&layers=trapnz-projects:my-projects&bbox=174.94,-41.5,174.95,-41&width=708&height=768&srs=EPSG:4326&format=application/openlayers
Notes:
The WFS server is set to return a maximum of 10k features per request. If you have more that, you will need to use software (e.g. ArcGIS Pro, or QuantumGIS) to page requests, or include count
and startindex
parameters . See the WFS specification.
The shapefile format has a number of limitations - see the Geoserver documentation. Datetime fields are not supported - only the date will be included.
Accessing the Trap.NZ map feeds with QGIS
Accessing layers
Create a new Server Connection and enter the WFS URL in the format described herehttps://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id
The WFS server is set to return a maximum of 10k features per request. If you have more than this number of features you must enable paging and set a page size less than 10,000. We recommend 5000.
Save and then click Connect to see the available layers:
You can then add individual or groups of layers to the map.
Filtering records
You can add a CQL filter to a WFS connection to filter features from the WSF server. This can greatly reduce the amount of data retrieved (speeding up the transfer and improving performance).
For example - if you are only interested in this year’s records, you could add a CQL filter to build the query as a filter before loading the layer from the server.
1. Connect to the server as above to see the list of available layers.
2. Select the layer you want to query (e.g. default-project-trap-records) and click the Build query button
3. In the dialog that appears, enter the following SELECT * FROM "default-project-trap-records" WHERE record_date > '2021-01-01'
(or whatever date you wish to use)
4. Press OK. The expression used will appear as the Sql value of the target layer:
When you add the layer now, only the filtered records (features) will be loaded.
Accessing the Trap.NZ map feeds with ArcGIS
Accessing layers
- You can add a new WFS Server via Connections > Server > New WFS Server:
- Enter the WFS URL in the format as described here
https://io.trap.nz/geo/trapnz-projects/wfs/apikey/project_id
- The WFS server is set to return a maximum of 10k features per request. Therefore you must set a page size value smaller than that. We suggest 5k to begin with. Add a custom request parameter of PAGESIZE, with a value of 5000
- Leave the Authentication options blank (we are using the API key to control access)
You will now see the available layers:
Working with the layers
Right-click or drag the layer to the map to see the features.
Note that, by default, ArcGIS only shows a maximum of 3000 features in the WFS layer. To change this, right-click the layers, select properties and then set the maximum features to something well above what you expect should be returned.
Filtering records
You can add a CQL filter to a WFS connection to filter features from the WSF server. This can be achieved by adding this parameter to the Custom request parameters - which can greatly reduce the amount of data retrieved (speeding up the transfer and improving performance).
For example - if you are only interested in this year’s records, you could add a CQL filter as a Custom request parameter
Add cql_filter as Parameter, and record_date %3E '2021-01-01' as Value.
Note: symbols such as ‘<’ and ‘>’ need to be URL encoded, hence the %3E in place of >
Attributions
The trap.nz map feeds and APIs are provided on the condition that you provide a data source attribution in any maps or material that uses these feeds, or data from these feeds.
E.g.:
"Sourced from trap.nz".
or
"Data sourced from trap.nz".
(if including the attribution on a web page, please link to https://trap.nz)