diff --git a/src/views/oneMap/map/newfiberMapBox.vue b/src/views/oneMap/map/newfiberMapBox.vue index cf827e1..a9e1b55 100644 --- a/src/views/oneMap/map/newfiberMapBox.vue +++ b/src/views/oneMap/map/newfiberMapBox.vue @@ -480,34 +480,33 @@ if (error) throw error; // Add the image to the map style. map.addImage('buildingLayer', image); + map.addSource("buildingSource", { + type: 'geojson', + data: buildingGeojson, + }) + + map.addLayer({ + id: 'buildingLayer-top', + type: 'fill-extrusion', + source: "buildingSource", + // //绘画功能 + paint: { + 'fill-extrusion-color': 'rgba(0,63,95,1)', + 'fill-extrusion-height': ['+',['get', 'height_3'],0.1], + 'fill-extrusion-base': ['get', 'height_3'], + 'fill-extrusion-opacity': 1, + }, + }); map.addLayer({ id: 'buildingLayer', type: 'fill-extrusion', - source: { - type: 'geojson', - data: buildingGeojson, - }, + source: "buildingSource", // //绘画功能 paint: { 'fill-extrusion-pattern': 'buildingLayer', - // Get the fill-extrusion-color from the source 'color' property. 从source 'color'属性获取fill- extrusive -color。 - // 'fill-extrusion-color':'rgba(200, 100, 240, 0.4)', - // "fill-extrusion-color":['get','color'],//加载数据中的颜色 - // 'fill-extrusion-color': { - // //根据数值中加载相对应颜色 - // property: 'height_3', // this will be your density property form you geojson - // stops: [ - // [10, '#009bdd'], - // [20, '#009bdd'], - // [30, '#009bdd'], - // [80, '#00a8de'], - // [100, '#24edff'], - // [125, '#24edff'], - // [300, '#24edff'], - // ], - // }, - // 从source 'height'属性获取填充-挤出-高度。 + 'fill-extrusion-color': '#ffffff', 'fill-extrusion-height': ['get', 'height_3'], + 'fill-extrusion-base': 0, 'fill-extrusion-opacity': 1, }, });