How to query

 

Basics of querying data from OGC APIs
 

APIs in this platform are all based on OGC API standards, which can be seen as newer versions for OGC Web Services, such as Web Feature Service (WFS) and Web Map Service (WMS).

OGC APIs are more interoperable, newer and easy to use. You only need to understand the most important resources to form a query that retrieves data from OGC APIs. The exact query syntax and parameters vary depending on the specific OGC API type and implementation. However, most queries are constructed on the same hierarchical pieces.

For example, the example of OGC API Features query:

  1. https://locationfinland.fi/finland/api/be is the landing page of the LocationFinland's Built Environment API.
  2. https://locationfinland.fi/finland/api/be/collections lists feature collections (= data sets) that are offered through the API.
  3. https://locationfinland.fi/finland/api/be/collections/be_buildings describes the feature collection named ‘buildings_FI’ that contains buildings from Finland.
  4. https://locationfinland.fi/finland/api/be/collections/be_buildings/items presents the features that are in the collection named ‘buildings_FI’.
  5. https://locationfinland.fi/finland/api/be/collections/be_buildings/items/f83036f2-f1f9-46cf-b844-06f11c3c60e3:5?f=html presents the feature with unique ID ‘f83036f2-f1f9-46cf-b844-06f11c3c60e3:5' using HTML format.
  6. https://locationfinland.fi/finland/api/be/collections/be_buildings/items/f83036f2-f1f9-46cf-b844-06f11c3c60e3:5?f=json presents the feature ‘f83036f2-f1f9-46cf-b844-06f11c3c60e3:5’ in GeoJSON format (requires a valid API key).

 

The example above had only one additional parameter ('f' for format) but also more can be added after the question mark to select only a subset of the features in the collection. A 'bbox' or 'datetime' parameter may be used to select only the subset of the collection features within the bounding box specified by the 'bbox' parameter or the time interval specified by the 'datetime' parameter. The 'limit' parameter may be used to control the page size by specifying the maximum number of features that should be returned in the response.

Each page may include information about the number of selected and returned features (‘numberMatched’ and ‘numberReturned’) as well as links to support paging (link relation ‘next’). Usually, the fastest way to check data is to write a query directly to a web browser. Another option is to use the command line, programming languages or some (GIS) software. See our How to use an API key page for instructions on adding the API key to your command line queries.

For more information about OGC APIs, please visit the Service Management course of Location Innovation Academy . You can register and learn more for free.

Location Finland

The Location Finland data platform provides novel data sources to develop new location-based business in Finland. Location Finland is one of the services provided by the Location Innovation Hub.

European Union logo

Location Innovation Hub logo