mapbox / mapbox/mapbox-gl-js

Add support for rendering different roof shapes

Open
#3,998 7 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cross-platform :tv: feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

migrated From https://github.com/mapbox/DEPRECATED-mapbox-gl/issues/17 by @nickidlugash

> What would it take to implement roof rendering for buildings, so we can improve the accuracy of renderings of complex and high-profile landmarks?
>
> Some questions I've been thinking about:
> #### Which OSM keys would we support?
>
> OSM currently has 1,028,142 features with a **`roof:shape`** tag (773,099 if you subtract the `flat` values, which would render identically to having no `roof:shape` tag).
>
> 205,223\* of these features also have a **`roof:height`** and/or **`roof:level`** value. These values would be helpful not just to render accurate height, but to give certain distinctive-looking roofs the proper proportions (e.g. very elongated pyramid-shaped roofs on cathedrals).
>
> The rest of the roof tags are probably not useful (either not relevant, or are not used widely enough).
> #### How would we represent roof properties in the spec?
>
> The current [spec additions](https://github.com/mapbox/mapbox-gl-style-spec/issues/456#issue-157015228) that @lbud has added to her working branch are all for a generic `extrusion` type, not a type specific to buildings, which I think makes sense. Adding roofs complicates this a bit. Some (possibly questionable) options:
> 1. Add `extrusion-top-shape` and `extrusion-top-height` properties (or however they would be named). This would involve creating support for a bunch of [simple 3D shapes](http://wiki.openstreetmap.org/wiki/Simple_3D_buildings#Roof). By far the most common are various triangular prisms and pyramids, but also includes spherical domes and onion domes. Are there use cases for additional geometries on top of an extrusion, besides for buildings?
> 2. Treat the roofs as a separate style layer, with a separate render type of `3d` or something. This type would require both `3d-shape` and `3d-height` properties as above, and also a `3d-min-height`. As above, it would require support for rendering a variety of simple 3D shapes. I haven't really thought this option through.
>
> Anyone who has any ideas of how this could work, and how big of a lift it would be, please chime in!
>
> \* 107,464 _(# of roof:height)_ + 116,983 _(# of roof:level)_ - 19,224 _(# with both)_ = 205,223
>

cc @lbud @ajashton @mapbox/gl @1ec5 @ajashton @mourner

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed generic extrusion additions in the linked style-spec discussion and the issue's alternatives for a separate 3D style layer. Trace how roof:shape, roof:height, and roof:level would reach the building renderer. Done means agreeing on a concrete representation and implementing support for the required roof geometries and proportions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.