以下为sgmap地图使用方法,sgmap封装的mapbox,对mapbox适用,如不适用,可评论更新
let map(mapbox地图)
let sourName(后台定义的数据源名称)
let url(瓦片地址)
let layerId(图层id)
let layerType = 'line' (图层类型、{line,point,symbol,polygon})
let sourceLayer(服务layer名)
map.addSource(sourName,{
“type”:"vector",
"tiles":[url],
"minZoom":0,
"maxZoom":22
});
map.addLayer("{
'id':layerid,
'type':layerType,
'source':sourName,
'layout':{
'line-cap':'round',
'line-join':'round',
'visibility':'visible'
},
'sourceLayer':sourceLayer,
'paint':{
'line-color':red,
'line-width':2,
'line-opacity':1,
'line-offset':0
}
}")