createOsmBuildings

suspend external fun createOsmBuildings(options: CreateOsmBuildingsAsyncOptions? = definedExternally): Cesium3DTileset(source)

Creates a Cesium3DTileset instance for the Cesium OSM Buildings tileset.

// Create Cesium OSM Buildings with default styling
const viewer = new Viewer("cesiumContainer");
try {
const tileset = await createOsmBuildingsAsync();
viewer.scene.primitives.add(tileset));
} catch (error) {
console.log(`Error creating tileset: ${error}`);
}
// Create Cesium OSM Buildings with a custom style highlighting
// schools and hospitals.
const viewer = new Viewer("cesiumContainer");
try {
const tileset = await createOsmBuildingsAsync({
style: new Cesium3DTileStyle({
color: {
conditions: [
["${feature['building']} === 'hospital'", "color('#0000FF')"],
["${feature['building']} === 'school'", "color('#00FF00')"],
[true, "color('#ffffff')"]
]
}
})
});
viewer.scene.primitives.add(tileset));
} catch (error) {
console.log(`Error creating tileset: ${error}`);
}

Parameters

options

Construction options. Any options allowed by the Cesium3DTileset constructor may be specified here. In addition to those, the following properties are supported:

See also