Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Buildings

Buildings are the main geometry type in Cityweft API. Meshes contains an array of meshes representing the building or its parts, which may include roofs.

Geometry Type: meshes

{
     "type": "buildings",
     "geometryType": "meshes",
     "meshes": Mesh[]
},

What does a Mesh element contain? This is the example:

{
     // The most important element of any meshed geometry for visualization
     "vertices": [x1, y1, z1, x2, y2, z2, ...],
     "descriptor": {
          source: "osm",
          hasDefaultHeight: Boolean,
          hasDefaultRoof: Boolean
     }
},

An example of how to render meshed geometry in Three.js (more infoThree.js Quick Guide)

const geometry = new THREE.BufferGeometry();
const verticesArray = new Float32Array(mesh.vertices);
geometry.setAttribute( 'position', new THREE.BufferAttribute( verticesArray, 3 ) );
geometry.computeVertexNormals();

We combine building data from multiple sources. You can use the source parameter to identify the specific source of each building.

Different colours for different data sources

Last updated