mapbox 插件

fill-extrusion-height :['interpolate',['linear'],['zoom'],t.minZoom,0,t.minZoom + 1, ['get', t.filed]] 

minZoom为白膜过渡动画的层级关系 filed为数据的高度字段 

 

添加图层方法 (geojson为例,d为数据源)
map.addSource('fitDistrict', {
         type: 'geojson',
         data: d
         })
map.addLayer({
         id: 'fitDistrict',
         type: 'line',
         source: 'fitDistrict'
      })
控制显隐藏layer.setLayoutProperty('visibility', 'visible') or none
 
标绘插件 mapbox-gl-draw
   const modes = MapboxDraw.modes
                modes.draw_rectangle = DrawRectangle
                modes.draw_circle = CircleMode
                map.draw = new MapboxDraw({
                    displayControlsDefault: false,
                    modes: modes
                })
                map.addControl(map.draw)

                map.on('draw.create', this.plottingEvents)
                map.on('draw.update', this.plottingEvents)
draw_rectangle  draw_circle 为draw扩展
触发标绘map.draw.changeMode('draw_line_string')
 
分屏同步插件 mapbox-gl-sync-move  
使用syncMove(this.map2, this.map3)

卷帘插件 mapbox-gl-compare
var container = '#comparison-container'
this.Compare = new mapboxgl.Compare(this.beforeMap, this.afterMap, container, {})
退出 
 this.Compare.remove()

posted on 2020-06-11 15:07  南风未起、  阅读(471)  评论(0)    收藏  举报

导航