createOsmBuildings

createOsmBuildings(options)Cesium3DTileset

Creates a Cesium3DTileset instance for the Cesium OSM Buildings tileset.
Name Type Description
options Object optional Construction options. Any options allowed by the Cesium3DTileset constructor may be specified here. In addition to those, the following properties are supported:
Name Type Default Description
defaultColor Color Color.WHITE optional The default color to use for buildings that do not have a color. This parameter is ignored if `options.style` is specified.
style Cesium3DTileStyle optional The style to use with the tileset. If not specified, a default style is used which gives each building or building part a color inferred from its OpenStreetMap `tags`. If no color can be inferred, `options.defaultColor` is used.
Returns:
Examples:
// Create Cesium OSM Buildings with default styling
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.scene.primitives.add(Cesium.createOsmBuildings());
// Create Cesium OSM Buildings with a custom style highlighting
// schools and hospitals.
viewer.scene.primitives.add(Cesium.createOsmBuildings({
  style: new Cesium.Cesium3DTileStyle({
    color: {
      conditions: [
        ["${feature['building']} === 'hospital'", "color('#0000FF')"],
        ["${feature['building']} === 'school'", "color('#00FF00')"],
        [true, "color('#ffffff')"]
      ]
    }
  })
}));
See: