I've been trying to come up with a simulator for buildings based on zoning codes, I can measure most values, create floors, etc, but I cant find a way to extrude diagonally, or creating a perpendicular plane to the floor, so I can evaluate the angle form the street to limit building height (image 2), is there a way to do this with mapbox gl ?, are there workarounds, adding threejs volume or some other way?
Asked
Active
Viewed 66 times
1 Answers
1
The easiest way to do this is likely to pre-process the data you need in QGIS before uploading it. It's particularly difficult to get a diagonally extruded polygon in Mapbox but there is a method that I've used before.
- Import the geojson of your building parcel into QGIS via the addLayer menu
- Create a grid by going to Vector > Research Tools > Create Grid > Square Grid
- Make sure the grid uses your polygon as the Grid Extent. Depending of the level of detail, I would make each portion to more than 0.5m horizontally, and vertically, you will want to provide the length of your home as a value
- Once created, select the entire grid and rotate the grid to match up with your desired, diagonal extrusion
- In the field calculator (Attribute Table > Field Calculator), create a new field called BASE_HEIGHT, and make the value 0 (or the value of your shape's base).
- Create another field called FILL_EXTRUSION_HEIGHT, then create an expression like
id / 5
, depending on what level of detail you want. - save the grid as a geojson file, and upload to mapbox, or add to your project.
- With the corresponding fields, you should have a diagonal shape.

Phil James
- 26
- 2
-
do you have an idea for doing this with an oval (e.g. the stands of a large soccer stadium)? – Cladjidane Jul 30 '23 at 09:16