3dcitydb / citydb-tool

3D City Database 5.0 CLI to import/export city model data and to run database operations
Apache License 2.0
9 stars 2 forks source link

Changes to geometry properties #6

Closed clausnagel closed 9 months ago

clausnagel commented 9 months ago

This PR proposes minor changes to the JSON object structure for geometry properties:

  1. The "hierarchy" array has been renamed to "children". The array now only contains the children of the root geometry. A redundant representation of the root geometry in the array as with the previous "hierarchy" is not required anymore. Consequently, the "parent" property is not required for direct children of the root geometry anymore but only for nested children. This makes the entire JSON object a bit more compact.

  2. Since the root geometry is not contained in "children" anymore, its geometry "type" must now be defined as property of the JSON object. This has the advantage that both "type" and "objectId" of the root geometry are now available from the JSON object without having to iterate over "hierarchy" as in the previous representation.

  3. There is no implicit assumption about the ordering of the "children" array anymore. Previously, parents were assumed to be stored before their children.

  4. The "type" property is now mandatory for both the root geometry and all children.

Examples:

General content of the JSON object:

{
  "type": 9,  // mandatory geometry type of the root geometry
  "objectId": "my-geometry",  // optional object ID of the root geometry
  "is2D": false, // optional, default is false
  "children": [  // optional
    ...
  ]
}

A point geometry:

{
  "type": 1,
  "objectId": "point"
}

A solid geometry:

{
  "type": 9,
  "objectId": "solid",
  "children": [
    {
      "type": 6,
      "objectId": "shell"
    },
    {
      "type": 5,
      "objectId": "polygon1",
      "parent": 0,
      "geometryIndex": 0
    },
    {
      "type": 5,
      "objectId": "polygon2",
      "parent": 0,
      "geometryIndex": 1
    },
   ...
  ]
}
clausnagel commented 9 months ago

Implemented JSON schema changes in the 3DCityDB repo with https://github.com/3dcitydb/3dcitydb/commit/a18440d92ac91c31800a333a45973bd15966e3f7