Species Alert Report - Developer Notes

Adding support for layers and regions

A good place to start when working with layers, is by playing around on spatial.nbnatlas.org and viewing the Inspector > Network tab. That's where you will see how layers and the regions within a layer are passed to the NBN Atlas API.

Precisely how the following are going to be used is yet to be determined! but these are definitely api calls that will be used when adding layers and regions to the Species Alert Report.

Get all the layers in the NBN Atlas (very generous!)

https://layers.nbnatlas.org/ws/layers

Let's say I'm interested in "Sites of Special Scientific Interest (England)" (even though I'm Welsh). The above JSON shows this has id 280. In NBN Atlas API calls, you usually need to stick "cl" in front of the layer id, so instead of using 280, you'll use cl280.

Get all the regions within the layer cl280:

https://layers.nbnatlas.org/ws/field/cl280

That JSON contains the WKT string for each region, which you could use, but you can also use the region name. So for example, to get all records in layer cl280 within the region named "Bell Sykes Meadows", this is the API call:

https://records-ws.nbnatlas.org/occurrences/search?q=cl280:"Bell Sykes Meadows"&fq=-occurrence_status:absent

You can view the records on records.nbnatlas.org (look at the URL in browser)

Back to Blog