You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, I faced a challenge where I want to display a roofs and panels on top of the building of standard map 3d ( Mapbox ). On 2D satellite the shapes appeared but when I switched to 3D , they appeared in the bottom of the base layer.
constaddRoof=(roof: Roof)=>{if(!mapRef.current)returnconstroofPolygonData=createRoofPolygonFeature(roof)// const roofSourceId = `roof-${address}-${roof.id}`// addRoofSource(roofSourceId, roofPolygonData)// addRoofLayers(roofSourceId, roof)//addRoofEventHandlers(roof)// Calculate the bounding box of the polygonconstcenter=turf.center(roofPolygonData)addPanelLayers(roof)addCenterSourceAndLayer(roof,center)}constcreateRoofPolygonFeature=(roof: Roof): Feature=>{constpolygon=turf.polygon([roof.coords])constroofCoordinates=polygon.geometry.coordinatesif(roof.holes){roof.holes.forEach((hole: Position[])=>{roofCoordinates.push(hole)})}constfeature={type: "Feature",properties: {},geometry: {type: "Polygon",coordinates: roofCoordinates,},}// Store the draw instance in the mapRefif(mapRef.current){constcurrent=mapRef.currentasMapWithDrawcurrent.draw.add(featureasFeature)}returnfeatureasFeature}
This discussion was converted from issue #2662 on July 26, 2024 17:32.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
Today, I faced a challenge where I want to display a roofs and panels on top of the building of standard map 3d ( Mapbox ). On 2D satellite the shapes appeared but when I switched to 3D , they appeared in the bottom of the base layer.
3D
2D
Drawing shapes code :
Beta Was this translation helpful? Give feedback.
All reactions