Help with geometry templates

Table of contents

  1. Matrices for translation/scaling/rotation
  2. How to calculate the (x,y,z) for the tree

The file geomtemplate.city.json (download it) shows an example of a Geometry template.

The file contains one tree (here in yellow because it is selected in the viewer) represented as a cube of 10mX10mX10m and modelled with a Geometry template. It is located in front of the building BK-City at TUDelft. As the metadata indicate, its CRS is EPSG:7415.

If you open the file with a viewer that supports geometry templates (eg azul and QGIS-plugin), and you open the corresponding 3D BAG file you should see the “tree” in front of the main entrance (as in the screenshot above). The centre of the tree is about at location (85178.0, 446878.0, 10.0).

First notice that the transformation matrix has “1” in the diagonal so that the template is used as is, not scaling/rotation/translation.

"geometry":
[
  {
    "type": "GeometryInstance",
    "template": 0,
    "boundaries": [0],
    "transformationMatrix": [
      1, 0, 0, 0, 
      0, 1, 0, 0, 
      0, 0, 1, 0, 
      0, 0, 0, 1 
    ] 
  }
]

The "boundaries": [0] means that the first vertex in "vertices" is used as the anchor point, and then the geometry template is a simple cube.

Matrices for translation/scaling/rotation

How to calculate the (x,y,z) for the tree