specs icon indicating copy to clipboard operation
specs copied to clipboard

are "geometry-templates" allowed in JSONL?

Open hugoledoux opened this issue 1 year ago • 2 comments

the text contradicts itself, should they be "resolved" (real-world coordinates) or is it okay to put them in the 1st line or stored somewhere?

hugoledoux avatar Oct 17 '22 08:10 hugoledoux

If we put the whole "geometry-templates" in the first line (and do not dereference them in the objects), then for the Railway dataset the 1st line is pretty large: 21KB (without spaces and newlines).

To keep in mind

hugoledoux avatar Oct 19 '22 14:10 hugoledoux

In contrast, I've been thinking about including the "geometry-templates" in the CityJSONFeature, but only containing the template(s) that is used by the feature.

For instance like this:

{
  "type": "CityJSONFeature",
  "id": "id-1",
  "CityObjects": {
    "id-1": {
      "type": "Building",
      "attributes": {
        "roofType": "gabled roof"
      },
      "children": ["mywindow"],
      "geometry": [...]
    },
    "mywindow": {
      "type": "BuildingInstallation",
      "parents": ["id-1"],
      "geometry": [
        {
          "type": "GeometryInstance",
          "template": 0,
          "boundaries": [372],
          "transformationMatrix": [
            2.0, 0.0, 0.0, 0.0,
            0.0, 2.0, 0.0, 0.0,
            0.0, 0.0, 2.0, 0.0,
            0.0, 0.0, 0.0, 1.0
          ]
        }
      ]
    }
  },
  "geometry-templates": {
    "templates": [
      {
        "type": "MultiSurface",
        "lod": "2.1",
        "boundaries": [
           [[0, 3, 2, 1]], [[4, 5, 6, 7]], [[0, 1, 5, 4]]
        ]
      }
    ],
    "vertices-templates": [
      [0.0, 0.5, 0.0],
      ...
      [1.0, 1.0, 0.0],
      [0.0, 1.0, 0.0]
    ]
  },
  "vertices": [...]
}

However, the problem with this approach, or with dereferencing the templates in the CityJSONFeature, as it says in the specs currently, is the duplication of objects. Imagine and application, a 3D viewer, that populates the scene by loading the CityJSONFeatures that are in the view. The features are buildings with templated windows on the facades. There are a lot of windows on one building, and even more on many buildings... :-D. If the window-templates need to be duplicated for each feature, then that'll mean a lot of extra geometry, which could be avoided by loading the templates only once and reusing them for the features.

I don't particularly like the idea of dumping more and more stuff in the "first line" (I call it metadata), but I think if we include the template definitions with the features, then we practically lose the possibility of using templates (in their true sense), when using CityJSONFeatures. And since CityJSONFeatures are meant for handling large areas, templates are probably even more useful than in regular CityJSON files.

balazsdukai avatar Oct 19 '22 16:10 balazsdukai