小編給大家分享一下GIS中mapbox gl有哪些底圖的加載,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
專注于為中小企業(yè)提供成都網(wǎng)站制作、網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)茂名免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了1000+企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
var map = new mapboxgl.Map({
container: 'map',
style: {
//目前地圖的版本用8
"version": 8,
//數(shù)據(jù)源,可以設(shè)置多個(gè)數(shù)據(jù)源
"sources": {
"mapsource": {
//數(shù)據(jù)源類型是 raster
"type": "raster",
//切片的地址:arcgis server 只有發(fā)布了切片才能這樣進(jìn)行訪問,具體參照arcgis server的wmts發(fā)布
"tiles": ['http://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/WMTS/tile/1.0.0/ChinaOnlineCommunity/default/default028mm/{z}/{y}/{x}.png']
//切片的尺寸,一般都是256
"tileSize": 256,
}
},
//加載數(shù)據(jù)源里的圖層
"layers": [{
"id": "mapsource",
"type": "raster",
//數(shù)據(jù)源選擇source中的id
"source": "mapsource",
//設(shè)置圖層的可縮放級別
"minzoom": 0,
"maxzoom": 18
} ]
}
});
//加載天地圖的矢量和注記圖層
style: {
"version": 8,
"sources": {
"mapsource": {
"type": "raster",
//天地圖的影像切片,現(xiàn)在天地圖需要申請token
"tiles":
['http://t1.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={z}&TileRow={y}&TileCol={x}&style=default&format=tiles&tk=
"tileSize": 256,
},
//注記的數(shù)據(jù)源,source中可以添加多個(gè)
annotationsource": {
"type": "raster",
"tiles": [' http://t0.tianditu.com/cva_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cva&tileMatrixSet=w&TileMatrix={z}&TileRow={y}&TileCol={x}&style=default&format=tiles&tk=
"tileSize": 256,
}
},
//分別加載多個(gè)天地圖的圖層
"layers": [{
"id": "mapsource",
"type": "raster",
"source": "mapsource",
"minzoom": 0,
"maxzoom": 18
},{
"id": "annotationsource",
"type": "raster",
"source": "annotationsource",
"minzoom": 0,
"maxzoom":18
}]
}
看完了這篇文章,相信你對“GIS中mapbox gl有哪些底圖的加載”有了一定的了解,如果想了解更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!