question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to implement 3D Buildings example

See original GitHub issue

The current <Layer> element doesn’t provide a way to implement the map layer as described in https://www.mapbox.com/mapbox-gl-js/example/3d-buildings/.

For example, there’s no way to add type: 'fill-extrusion' to the <Layer /> element as it is not one of the recognized values for the type prop. The source prop also cannot be a string.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
mklopetscommented, Sep 6, 2018

The code in this thread is about an older version of react-mapbox-gl. Please see the 3d-map demo on our demos page @Emixam23

1reaction
alex3165commented, Dec 19, 2016

Hey @masotime, sorry for the late reply, this can be achieved using the layerOptions property :

export default class ThreeDBuilding extends React.Component {
  render() {
    return (
      <ReactMapboxGl
        style={style}
        accessToken={accessToken}
        containerStyle={styles.container}
      >
        <Layer
          id="3d-buildings"
          sourceId="composite"
          layerOptions={{
            'source-layer': 'building',
            'filter': ['==', 'extrude', 'true'],
            'type': 'fill-extrusion',
            'minzoom': 15
          }}
          paint={{
            'fill-extrusion-color': '#aaa',
            'fill-extrusion-height': {
                'type': 'identity',
                'property': 'height'
            },
            'fill-extrusion-base': {
                'type': 'identity',
                'property': 'min_height'
            },
            'fill-extrusion-opacity': .6
          }}/>
      </ReactMapboxGl>
    );
  }
}

Although I would suggest you not to implement this kind of layer using react-mapbox-gl but I would define it in the style JSON file that you pass down to the style props of the Map. The Layer and Feature component should only be used for dynamic elements on the map, the ones that need update logic or user interactions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble getting 3D buildings in Unreal Engine - Esri Community
Specifically, I'm trying to get buildings to show up in Orem, Utah, USA, but nothing appears. I believe this may be because the...
Read more >
How to create 3D Buildings for your Maps? - Mapme
With Mapme, you can easily display 3D buildings on maps. You can choose to show all the buildings in 3D or select specific...
Read more >
Example: 3D Building Map - Osm2pgsql
Example : 3D Building Map. 3D map of lower Manhatten. You need at least osm2pgsql version 1.7.0 for this example. For some buildings...
Read more >
4 Easy Ways to Import OpenStreetMap 3D Buildings into ...
... 4 different ways on how you can import OpenStreetMap 3D buildings directly into your SketchUp ... Your browser can't play this video....
Read more >
How to fix non-manifold geometry issues on 3D models
This is a very common error that may occur while creating a digital object. This is because during the creation of a 3D...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found