info.laji.fi

Knowledge base of the FinBIF

The geoapi.laji.fi is based on OGC API Features standard, which can be seen as newer version for OGC Web Feature Service (WFS). Actually, the original name of OGC API Features was WFS3.0 but due to new fundamental principles, OGC decided to change the name.

OGC APIs are more interoperable, modern and easy to use. To use them, it might be good to understand some basic principles.

Esimerkiksi OGC API Features -kyselyssä:

ResourcePathPurpose
Landing page/This is the top-level resource, which serves as an entry point.
Conformance declaration/conformanceThis resource presents information about the functionality that is implemented by the server.
API definition/apiThis resource provides metadata about the API itself.
Feature collections/collectionsThis resource lists the feature collections that are offered through the API.
Feature collection/collections/{collectionId}This resource describes the feature collection identified in the path.
Features/collections/{collectionId}/itemsThis resource presents the features that are contained in the collection.
Feature/collections/{collectionId}/items/{featureId}This resource presents the feature that is identified in the path

For example, in the example OGC API Features query:

https://geoapi.laji.fi/ is the landing page.

https://geoapi.laji.fi/collections lists all feature collections (= data sets) offered through the API.

https://geoapi.laji.fi/collections/pohjois_savo_points describes the feature collection named ‘pohjois_savo_points’ that contains occurrences from the given area.

https://geoapi.laji.fi/collections/pohjois_savo_points/items presents the occurrences that are in the collection named ‘pohjois_savo_points’.

https://geoapi.laji.fi/collections/pohjois_savo_points/items/HR.3211/19455829-U presents the specific occurrence from the given collection with the local ID

https://geoapi.laji.fi/collections/pohjois_savo_points/items/HR.3211/19455829-U?f=json presents the same occurrence using JSON formatting. You can just save this as a text file and open in QGIS, as an example.

The examples above had only one additional parameter (f=json for GeoJSON formatting) but also more can be added after the question mark to select subsets instead of the whole collection.

Use bbox or datetime parameters to select a subset within geographical bounding box or time interval. You can also filter data by any attribute. See the examples below.

The limit parameter can be used to specify the maximum number of features to be returned. However, the API use pagination, so it returns only 10000 features on each page. With the page parameter you can select which page you want to access.

Usually, the fastest way to check query is to write it directly to a web browser. That allows inspecting data in GeoJSON or HTML format. For other purposes, you can link the API directly to some GIS application (see instructions here) or use it through command line or programming languages.

How to form a query?

For most use cases, you can just connect the API to your GIS software using the URL https://geoapi.laji.fi/, but for more advanced use see the examples below.

List all collections:

http://geoapi.laji.fi/collections

Overview of the dataset:

http://geoapi.laji.fi/collections/pohjois_savo_points

Display queryables (= attributes that can be used to filter data):

http://geoapi.laji.fi/collections/pohjois_savo_points/queryables

Explore occurrences in a browser:

http://geoapi.laji.fi/collections/pohjois_savo_points/items

Example of using pagination. Skip the first 40 occurrences and fetch only 20 occurrences:

http://geoapi.laji.fi/collections/pohjois_savo_points/items?offset=40&limit=20

Download results in Comma Separated Value (CSV) format. This tabular format can be opened, for example, in Excel.

http://geoapi.laji.fi/collections/pohjois_savo_points/items?f=csv

Limit occurrences geographically using bbox parameter. As a default, coordinates are in WGS84 coordinate reference system.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?bbox=25.357839,61.06715,27.58347,62.81241&limit=10000

Filter occurrences geographically using ETRS-TM35FIN coordinates (which EPSG code is 3067).

https://geoapi.laji.fi/collections/pohjois_savo_points/items?bbox=382509.7534,6669242.4856,389113.5653,6674052.2373&bbox-crs=https://www.opengis.net/def/crs/EPSG/0/3067

Query only occurrences where the value of column ‘Alkuperainen_nimi’ is ‘kuikka’.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?Alkuperainen_nimi=kuikka

Filter occurrences based on timestamp.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?datetime=2024-04-10T14:11:00Z

Get first 100 occurrences and sort them by the column ‘Alkuperainen_nimi’. Use minus (-) character to sort them by descending order and plus (+) character by ascending.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?limit=100&sortby=-Alkuperainen_nimi

Get the occurrences in ETRS-TM35FIN coordinate system.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?crs=https://www.opengis.net/def/crs/EPSG/0/3067

Get specific occurrences based on collection id.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?Havaintoeran_tunniste=http://tun.fi/HR.3691/OBS747597086

Fetch data from multiple collection with a single query. (Not supported yet in 8.7.2024.)

http://geoapi.laji.fi/collections/search?collections=pohjois_savo_points,etela_savo_polygons&limit=1

More complex CQL queries:

If you use data only in GIS software, you can use their tools to build queries. However, building CQL (Common Query Language) queries can be useful for many situations. Here some examples below:

Find all observations from the ‘Birds’ dataset where the name contains the word ‘haukka’. In the query, the filter-lang parameter specifies that the more complex CQL query language is to be used. With the ILIKE filter, all values whose field contains the string ‘haukka’ are retrieved. The notation ‘%20’ represents a space and ‘%27’ represents an apostrophe. A single percent sign ‘%’ on both sides of the word ‘haukka’ indicates any characters that the given string can be combined with. Thus, the name could be, for example, ‘nuolihaukka’ or even ‘abchaukkaabc’.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?filter-lang=cql-text&filter=Alkuperainen_nimi%20ILIKE%20%27%haukka%%27

Retrieve all occurrences where their name does not contain the word ‘haukka’.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?f=html&filter-lang=cql-text&filter=Alkuperainen_nimi%20NOT%20ILIKE%20%27%haukka%%27

Retrieve first 200 occurrences whose name is either “merikotka” or “kuikka”.

https://geoapi.laji.fi/collections/pohjois_savo_points/items?f=html&limit=200&filter-lang=cql-text&filter=Alkuperainen_nimi%20IN%20(%27merikotka%27,%27kuikka%27)

Find more CQL filtering examples from the pygeoapi documentation.

Scroll to top