Features - JSON-FGspecdraftimplcandidate
Encode features as JSON-FG.
Scope
GeoJSON is a popular encoding for feature data. It is the default encoding for features in ldproxy. However, GeoJSON has intentional restrictions that prevent or limit its use in certain contexts. For example, GeoJSON is restricted to WGS 84 coordinates, does not support volumetric geometries and has no concept of classifying features according to their type.
OGC Features and Geometries JSON (JSON-FG) is an OGC candidate standard for GeoJSON extensions that provide standard ways to support such requirements.
The role PRIMARY_GEOMETRY
is used to select the primary spatial property for the "place" or "geometry" member.
For the JSON-FG+ profile, that is, with geometries in both "place" and "geometry", a separate spatial property has to be specified with the role SECONDARY_GEOMETRY
which will be represented in OGC:CRS84/OGC:CRS84h in the "geometry" member. That property is not represented, if the profile is not JSON-FG+.
The roles PRIMARY_INSTANT
, PRIMARY_INTERVAL_START
, and PRIMARY_INTERVAL_END
are used to select the temporal properties for the "time" member.
The role TYPE
can be used to annotate a property that contains the type of the feature. The property value will be represented in the "type" member of the feature.
The three GeoJSON profiles specified in JSON-FG are supported. The GeoJSON profiles only apply when the response media type is "application/geo+json".
- The default profile "rfc7946" returns GeoJSON without any JSON-FG extensions.
- The profile "jsonfg" returns GeoJSON with all applicable JSON-FG extensions.
- The profile "jsonfg-plus" returns GeoJSON with JSON-FG extensions with the additional
constraint that the "geometry" member is notnull
to support GeoJSON clients unaware of
JSON-FG. The profile is only enabled, if the schema contains a property with the roleSECONDARY_GEOMETRY
.
Conformance Classes
The building block implements the Requirements Classes "Core", "Polyhedra", "Feature Types and Schemas", "GeoJSON Profiles", and "JSON-FG in Web APIs" of JSON-FG 0.3.0 (DRAFT). The implementation may change as the draft can evolve during the standardization process.
Configuration
Options
Name | Default | Description | Type | Since |
---|---|---|---|---|
buildingBlock | Always JSON_FG . | string | v2.0 | |
enabled | false | Enable the building block? | boolean | v2.0 |
transformations | {} | Property transformations do not affect data sources, they are applied on-the-fly as part of the encoding. Filter expressions do not take transformations into account, they have to be based on the source values. That means queryable properties (see queryables in Features) should not use transformations in most cases. The exception to the rule is the HTML encoding, where readability might be more important than filter support. | object | v2.0 |
supportPlusProfile | true | Activates support for the "jsonfg-plus" profile. In that profile, JSON-FG features with a "place" member will also include a GeoJSON geometry in the "geometry" member in WGS 84. Otherwise, the "geometry" member of a JSON-FG feature will be null , if the "place" member is present. | boolean | v4.5 |
geojsonCompatibility | true | Deprecated (replaced by supportPlusProfile ). | boolean | v3.3 |
featureType | [] | Deprecated (replaced by featureTypeV1 ). Only the first value of the list is used. | array | v3.1 |
featureTypeV1 | see description | Replaces featureType , will be renamed in v5.0 to featureType . Features are often categorized by type. Typically, all features of the same type have the same schema and the same properties. Many GIS clients depend on knowledge about the feature type when processing feature data. For example, when associating a style to a feature in order to render that feature on a map. This option adds a "featureType" member with the specified value. A value can include a template {{type}} , which will be replaced with the value of the feature property with role: TYPE in the provider schema of the feature type of the collection. The property must be of type STRING . If the feature type in the provider schema includes an objectType value, the value will be used as the default. Otherwise, the default is null . | string | v3.1 |
links | [] | Adds the specified links to the links array of features. All values of the array must be a valid link object with href and rel . | array | v3.1 |
Examples
Example of the information in the configuration file for the entire API (from the API for Topographic Data in Daraa, Syria):
- buildingBlock: JSON_FG
enabled: true
featureType:
- nas:{{type}}
Additional information per feature collection with an attribute F_CODE
(for which role: TYPE
was set in the provider configuration) to set the object type:
- buildingBlock: JSON_FG
featureType:
- nas:{{type}}
This outputs the object type as follows for a value of "GB075" in the 'F_CODE' attribut:
{
"type": "Feature",
"id": 1,
"featureType": "nas:GB075",
...
}