cityjson / specs

Specifications for CityJSON, a JSON-based encoding for 3D city models
https://cityjson.org
Creative Commons Zero v1.0 Universal
107 stars 25 forks source link

Require at least one item in the boundaries array #189

Closed balazsdukai closed 4 months ago

balazsdukai commented 9 months ago

Discussed in https://github.com/cityjson/specs/discussions/188

Originally posted by **balazsdukai** November 21, 2023 Geometries are not obligatory for CityObjects, so we have three valid options: - `{ "type": "Building" }` - `{ "type": "Building", "geometries": [ ] }` - `{ "type": "Building", "geometries": [ ... ] }` Then, a `Geometry` object must have a `"boundaries"` member with an array of vertex indices. But the specs does not explicitly allow or forbid empty arrays, such as `"boundaries": [ ]`. In my opinion, it does not make much sense to have a Geometry object with empty boundaries, but it can happen. For instance due to a failed procedure that creates the geometry. Should we consider an empty `boundaries` a valid or invalid CityJSON?
hugoledoux commented 5 months ago

I'd say the boundaries shouldn't be empty, it should have the depth required by the schema, and have at least one element (for MultiPoint).

If a process fails then I'd say the whole geometry shouldn't be written to the file, no?

If we added for all GeometryPrimitives "minItems": 1 at each depth of the boundaries arrays, then it solves this.

See this snippet, you can test the behaviour: https://www.jsonschemavalidator.net/s/FjHIlkhP