Geonovum / uml2json

Best Practise for OGC - UML to JSON Encoding Rules
https://geonovum.github.io/uml2json/document.html
0 stars 1 forks source link

7.5.4. Primary geometry #18

Closed lvdbrink closed 1 year ago

lvdbrink commented 1 year ago

It would be nice not to have to tag each geometry property with primaryGeometry = true if you have a UML model that only has classes with one geometry property (which is very often the case).

I'm wondering if we could make a rule that says "a UML property that is owned by a <<featureType>> and has as type one of the types from 7.5.1 and no sibling properties that also have one of these types shall be encoded as a type restriction for the top-level “geometry” member. "

Or some other way of stating the rule in 7.5.4 only applies if a class has more than one geometry property.

jechterhoff commented 1 year ago

Good point. A solution is a bit tricky, though. On first glance, I would agree: if a feature type only has a single geometric property, then that should automatically be used as primary geometry, without having to tag it as jsonPrimaryGeometry = true.

The tricky cases are:

That is why we ended up with current phrasing, i.e., requiring explicit tagging of the UML property that is to be encoded within the GeoJSON "geometry" member.

I see two solutions:

Afaics, the second solution covers all cases - but please double-check, because the devil is in the details. In case of a single geometry property, where that property shall NOT be encoded within the GeoJSON "geometry" member for some reason (in both the GeoJSON and JSON-FG compliant encodings), it needs to be tagged with jsonPrimaryGeometry = false. Reasons include, but are not necessarily limited to:

In the application schema example in Annex B, we could then omit tag "jsonPrimaryGeometry" (the diagram note erroneously says "primaryGeometry") on feature type Parcel. We could also do that for feature type Building_Core, but it does not hurt to keep the tag there, since subtype BuildingPart has property extent3d, which is tagged with jsonPrimaryPlace = true. The explicit tagging makes it clear which property is the primary geometry and which is the primary place.

I'm open for further suggestions.

lvdbrink commented 1 year ago

Part B: If the set of (direct and inherited, but ignoring redefined) UML properties of a <> only contains a single UML property with a geometric type (defined by ISO 19107:2003, i.e., having a name that starts with "GM_", or made known to be a geometric type by external means), and that property is directly owned by the feature type, and that property does NOT have tag "jsonPrimaryGeometry" with value equal to, ignoring case, "false", then that property shall be encoded as the primary geometry of the feature type (see part C).

The only question I have is: what if the property is of type GM_Solid or some other 19107 type that is not supported by GeoJSON?

But then again, we are not checking that in the current 7.5.4 A, either. My feeling is it's up to the model owner to make sure only geometries that GeoJSON supports end up as primary geometry, and to tag others with jsonPrimaryGeometry = false.

jechterhoff commented 1 year ago

@lvdbrink: Yes, your feeling is correct: It is up to the model owner to make sure only geometries that GeoJSON supports end up as primary geometry, and to tag others with jsonPrimaryGeometry = false.

jechterhoff commented 1 year ago

Decision: Update the requirement as proposed, and in part B of the solution

Part B: If the set of (direct and inherited, but ignoring redefined) UML properties of a <<FeatureType>> only contains a single UML property with a geometric type (as defined in section 7.4.1), and that property is directly owned by the feature type, and that property does NOT have tag "jsonPrimaryGeometry" with value equal to, ignoring case, "false", then that property shall be encoded as the primary geometry of the feature type (see part C).