0

Looking at https://osmbuildings.org/?lat=47.37445&lon=8.54104&zoom=16.0&tilt=30 I see lots of 3D buildings in Zurich, Switzerland but in the OSM source data (e.g. from Geofabrik) I don't see nearly enough "building:part" and "height" tags to render that numbers of 3D buildings. Is https://osmbuildings.org/ built using some additional data set? Is it publicly accessible? OSM coverage for 3D building data seems very sparse (a few hundred buildings in Zurich).

1
  • 3
    It seems most buildings have the same rendered height (a default value!) and just a few have an actual height or number of levels
    – JGH
    Sep 7, 2021 at 15:48

1 Answer 1

5

As mentioned in the comments, there appears to be a default height applied to anything that doesn't have specific levels or height information.

You can see this in the source code. This seems to be the part that decides what height to make the building based on its properties.

if (properties.height !== undefined) {
      maxHeight = properties.height;
      dim.roofHeight = Math.min(dim.roofHeight, maxHeight); // we don't want negative wall heights after subtraction
      dim.roofZ = maxHeight-dim.roofHeight;
      dim.wallHeight = maxHeight - dim.roofHeight - dim.wallZ;
    } else if (properties.levels !== undefined) {
      maxHeight = properties.levels*METERS_PER_LEVEL;
      // dim.roofHeight remains unchanged
      dim.roofZ = maxHeight;
      dim.wallHeight = maxHeight - dim.wallZ;
    } else {
      switch (properties.shape) {
        case 'cone':
        case 'dome':
        case 'pyramid':
          maxHeight = 2*dim.radius;
          dim.roofHeight = 0;
          break;

        case 'sphere':
          maxHeight = 4*dim.radius;
          dim.roofHeight = 0;
          break;

        case 'none': // no walls at all
          maxHeight = 0;
          break;

        // case 'cylinder':
        default: <!--HERES THE DEFAULT-->
          maxHeight = DEFAULT_HEIGHT;
      }

https://github.com/OSMBuildings/OSMBuildings/blob/55e22a6d09911550225625d1c87a87bf8260f6b9/src/triangulate/index.js#L288

This might not be the exact bit of code that renders it (I've not taken the time to really delve into it), but was the best I could find.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.