Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Geonovum-labs/json-fg-linter
Browse files Browse the repository at this point in the history
  • Loading branch information
joostfarla committed Feb 28, 2024
2 parents 76d6416 + bbe6760 commit 7da363b
Showing 1 changed file with 31 additions and 37 deletions.
68 changes: 31 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,35 @@ This repository contains a linter for OGC Features and Geometries JSON (JSON-FG)

The linter rules are based on JSON-FG requirements classes [Core](https://docs.ogc.org/DRAFTS/21-045.html#rc_core), [3D](https://docs.ogc.org/DRAFTS/21-045.html#rc_3d) and [Features types and Schemas](https://docs.ogc.org/DRAFTS/21-045.html#rc_types-schemas). In addition, the linter does some consistency checks that are useful but not based on explicit requirements.

In addition to requirements that can be validated with the JSON-FG JSON Schema, the following rules are also implemented. When based on JSON-FG requirements or recommendations this is stated in the list.
The following table gives an overview of supported JSON-FG requirements. The codes in the Rules column are the
requirement names as listed in the OGC standard document. The table mentions separate sub requirements (e.g. "A", "B") only when some are and some are not supported.

| Rule | Supported | Description |
| :-----------------------------------------| :--------:| ----------- |
| /req/core/schema-valid | **yes** | JSON Schema validation |
| /rec/core/properties | no | GeoJSON compatibility mode |
| /req/core/metadata | **yes** | Presence of conformance statement |
| /req/core/instant | **yes** | Valid dates / times in instants |
| /req/core/interval | **yes** | Valid dates / times in intervals |
| /req/core/instant-and-interval | **yes** | Consistancy between instant and interval |
| interval start is before interval end | **yes** | This is checked in addition to the official requirements |
| /req/core/utc | **yes** | Always UTC ("Z") timezone |
| /req/core/coordinate-dimension | **yes** | All positions in a geometry have the same dimension |
| /req/core/geometry-wgs84 | **yes** | WGS84 geometries within range |
| /req/core/geom-valid | no | Validity of geometries |
| /req/core/place | **yes** | No valid GeoJSON geometries in `place` |
| /req/core/geometry-collection | **yes** | All coordinates in a collection have the same CRS |
| /req/core/fallback - A | **yes** | Geometries in `geometry` and `place` are not the same |
| /req/core/fallback - B | no | GeoJSOn compatibility is indicated in when the document is a GET response |
| /req/core/axis-order | no | Conformance to OGC axis order policy |
| /rec/core/place-crs | no | Coordinates in `place` within range of the used CRS |
| /req/3d/metadata | **yes** | Presence of conformance statement for 3D geometries |
| /req/3d/coordinate-dimension | **yes** | All positions in a 3D geometry have 3 dimensions |
| /req/3d/geom-valid | no | Valid 3D geometries |
| /req/types-schemas/metadata | **yes** | Presence of metadata conformance statement |
| /req/types-schemas/feature-type | **yes** | Presence of `featureType` |
| /req/types-schemas/geometry-dimension | no | Valid value of `geometryDimension` |
| /rec/types-schemas/homogeneous-collection | no | `featureType` and `geometryDimension` stated on collection level when all are the same |
| /req/types-schemas/feature-schemas | no | Referenced schemas must conform to OGC API Features part 5: Schemas |
| /req/types-schemas/single-feature-schema | no | Consistency between feature schema and feature type |

### time

- Requirement 4B-C: validate type consistency for "interval" ends.
- Requirement 5A-E: validate consistency between "date", "timestamp" and "interval".
- Validate that interval start is before interval end ([spec issue](https://github.com/opengeospatial/ogc-feat-geo-json/issues/122)).

### conformsTo (can be HTTP URI or Safe CURIE):

- Validate that conformance with Core is stated - this must always be set
- give a warning, if 3D conformance is stated but neither Polyhedron, MultiPolyhedron, Prism, nor MultiPrism is used
- validate that 3D conformance is stated if Polyhedron, MultiPolyhedron, Prism, or MultiPrism geometries are present
- give a warning, if Feature Types and Schemas conformance is stated but "featureType" is not used
- validate that Feature Types and Schemas conformance is stated if "featureType" is present

### all geometries:

- Requirement 7: validate that all coordinates have the same dimension
- Requirement 8A-B: validate that coordinates in the "geometry" member are within WGS84 bounds
- Requirement 9: validate all GeoJSON geometries including embedded ones in a Prism using a library that supports Simple Features validation
- Requirement 10: validate that there are no point, line string or polygon geometries in WGS 84 longitude/latitude in "place"
- Requirement 11: validate that all coordinates within a geometry collection in a "place" member are in the same CRS
- Requirement 12A: if both "geometry" and "place" are not null, validate that their values are not identical
- Requirement 2 give a warning if positions in coordinates are outside the valid range for the CRS
- validate that the coordinate dimension is consistent with the CRS (this is not currently a requirement, but makes sense as an additional test)
- Requirement 10: validate that the geometries are consistent with the stated geometry dimension

### 3D geometries:

- Requirement 15: validate that Polyhedron and MultiPolyhedron geometries have a coordinate dimension of 3.
- Requirement 16: validate for Polyhedron geometries that each shell is a composite and closed; voids must be in the outer shell

### feature types and schemas:

- Recommendation 3a: give a warning if all features in a feature collection have the same feature type and the feature type information is not specified on the collection.
- Recommendation 3b: give a warning if all geometries in a feature collection have the same dimension and geometryDimension is not stated on the collection level.
- Requirement 21: if a single feature schema is referenced, validate that all "featureType" members declare a single feature type and have the same value.

0 comments on commit 7da363b

Please sign in to comment.