How to render Mapbox buildings

First off, sorry if the answer is supposed to be obvious, I genuinely have no idea where to find the information on this.

I want to be able to pick my lat, long, and zoom level, and get a 3d map and buildings as meshes thrown into the threejs scene, that’s the dream. The purpose is for it to be an environment to roam, no map information needed other than ground countours and building shape+dimensions.

I’ve tried finding stuff which claim to do this and found several, but settled on three-geo since it looked simplest. It was able to get the terrain, but no buildings show up. I tried increasing the zoom level to 18 and still only got terrain.

Apparantly I was supposed to use vector-tiles and convert them into meshes from there, I tried using a different function in three-geo which claimed to settle this, but it got CORS errors. Then I tried using tile.ourmap.us as my tile provider, which from what I understood claimed to allow localhost to access their data, and vector-tile instead just to see the data I get, but got the same CORS errors. I began suspecting pulling vector tiles might have been a paid feature in mapbox, but the answer has been surprisingly vague, I still have no idea.

Next things I’m thinking of trying are threebox which I thought might have been overengineered for my purpose, although I suspect the main issue is the CORS errors, so I’m not sure anything would change from using threebox. The other thing would be to download the vector-tiles I want and go from there, though it would be a completely unchanging map at that point, which I’m not sure I’m fine with yet.

I’m just not entirely sure how to proceed, any guidance would be greatly appreciated. If you have better ways than what I’m thinking for my next steps, please let me know as well.

In mapbox you have to setup the fillExtrusionLayer for this…

Styles | Mapbox Studio manual | Mapbox.

3 Likes

Very enlightening, thank you.

Am I able to make use of this in three-geo and how, or will I need to use something else altogether?

1 Like

I’ve not used three-geo but I don’t see why you wouldn’t be able to mix tile-sets, one thing to note is that mapbox’s extrusions layer and underlying dataset is likely a proprietary tileset for use exclusively inside mapbox itself, you may be able to find an open source dataset for this or try maplibre which is open source and has an almost exact replica of the extrusion layer…

1 Like

Figures I should have checked for open source alternatives to Mapbox. Thank you again, but this time for the direction.

1 Like