OGC API Features
The GeoJSON client discussed in the previous chapter allows reading data from a static web resource or a local file. However most often geospatial APIs contains huge datasets, and data items to be queried must be selected and filtered.
1️⃣ Part 1: Core
A compliant (according to OGC API - Features - Part 1: Core) API service should provide at least following resources:
Resource | Path | Description |
---|---|---|
Landing page | / | Metadata about the API. |
Conformance classes | /conformance | Conformance classes supported by the API. |
Feature collections | /collections | Metadata about all feature collections provided by the API. |
Feature collection | /collections/{collectionId} | Metadata about a single feature collection provided by the API. |
Features | /collections/{collectionId}/items | Feature items (with geometry and property data) in a specified feature collection provided by the API. |
Feature (by id) | /collections/{collectionId}/items/{featureId} | A single feature item (with geometry and property data) in a specified feature collection provided by the API. |
Most services also provide an API definition (ie. an Open API 3.0 document) at
/api
describing the capabilities of the API service.
See geodata_example.dart for a sample how to read metadata and feature items from an API service conforming to OGC API Features.
Most relevant portions of this sample:
As mentioned above, see geodata_example.dart for the full sample.
2️⃣ Part 2: Coordinate Reference Systems by Reference
The Part 1: Core
defined feature services that support only accessing data
using WGS 84 longitude / latitude coordinates (with optional height or
elevation).
The second part of the OGC API - Features
standard is
OGC API - Features - Part 2: Coordinate Reference Systems by Reference
that specifies how servers publish supported coordinate refererence systems (as
CRS identifiers) and how clients request and receive geospatial feature items
whose geometries (coordinates) are in “alternative coordinate reference systems”
(other than WGS 84 longitude/latitude).
The following example demonstrates these capabilities (see the full sample at ogcapi_features_crs_example.dart):
3️⃣ Part 3: Filtering
The third standard part, OGC API - Features - Part 3: Filtering, further extends capabilities of feature services, with support for feature filtering. This standard also use Common Query Language (CQL2) that specifies a filtering grammar and two encodings (text and JSON) to express those filters.
For example when client
is OGCFeatureService
and source
is
OGCFeatureSource
, and both are initialized just like in the previous samples,
then it’s possible to check for the support of filtering, get queryable
properties, and utilize properties in simple (queryables as query parameters in
HTTP requests):
Queryable properties can also be utilized in more complex filters (based on the
Common Query Language (CQL2)
). See the API documentation of items
and itemsPaged
methods in
OGCFeatureSource
for more information.