mapbox-gl加載超圖iserver發(fā)布切片
如何在mapbox-gl加載超圖iserver發(fā)布的切片數(shù)據(jù)。
超圖isever發(fā)布數(shù)據(jù)的形式,跟arcgis server發(fā)布的有些不同,在加載時,也有一定的區(qū)別,超圖在線可測試地圖數(shù)據(jù)網(wǎng)址如下:http://support.supermap.com:8090/iserver/services/map-world/rest/maps/World
支持操作如下截圖:??

mapbox-gl加載iserver發(fā)布的切片數(shù)據(jù),可以采取以下幾種方式:
tileFeature 矢量切片形式
tileImage? ?經(jīng)緯度切片形式
zxyTileImage?墨卡托切片形式??
1、tileFeature?加載
http://support.supermap.com.cn:8090/iserver/iClient/forJavaScript/examples/mapboxgl/editor.html#mvtVectorTile
數(shù)據(jù)源:
"sources": {
? ? ? ? ? ? ? ? "vector-tiles": {
? ? ? ? ? ? ? ? ? ? "attribution": attribution,
? ? ? ? ? ? ? ? ? ?"type": "vector",
? ? ? ? ? ? ? ? ? ?"tiles": [host + "/iserver/services/map-china400/rest/maps/China/tileFeature.mvt?_cache=false&returnAttributes=true&width=512&height=512&viewBounds={bbox-epsg-3857}"]
? ? ? ? ? ? ? ? },
? ? ? ? ? ? },
? ? ? ? ?加載其中的圖層:
? ? ? ?map.addLayer({
? ? ? ? ? ? "id": "China_Boundary",
? ? ? ? ? ? "type": "line",
? ? ? ? ? ? "source": "vector-tiles",
? ? ? ? ? ? "source-layer": "China_Boundary_A_ln@China",
? ? ? ? ? ? "paint": {
? ? ? ? ? ? ? ? "line-color": "hsl(230, 8%, 51%)",
? ? ? ? ? ? ? ? "line-width": {
? ? ? ? ? ? ? ? ? ? "base": 1,
? ? ? ? ? ? ? ? ? ? "stops": [
? ? ? ? ? ? ? ? ? ? ? ? [
? ? ? ? ? ? ? ? ? ? ? ? ? ? 3,
? ? ? ? ? ? ? ? ? ? ? ? ? ? 0.5
? ? ? ? ? ? ? ? ? ? ? ? ],
? ? ? ? ? ? ? ? ? ? ? ? [
? ? ? ? ? ? ? ? ? ? ? ? ? ? 10,
? ? ? ? ? ? ? ? ? ? ? ? ? ? 2
? ? ? ? ? ? ? ? ? ? ? ? ]
? ? ? ? ? ? ? ? ? ? ]
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? });
2、tileImage? ?加載http://support.supermap.com.cn:8090/iserver/iClient/forJavaScript/examples/mapboxgl/editor.html#01_tiledMapLayer_4326數(shù)據(jù)源:
tiles: [host + '/iserver/services/map-world/rest/maps/World'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? rasterSource: 'iserver'
圖層:
? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? ? ? id: 'simple-tiles',
? ? ? ? ? ? ? ? ? ? ? ? ? ? type: 'raster',
? ? ? ? ? ? ? ? ? ? ? ? ? ? source: 'raster-tiles',
? ? ? ? ? ? ? ? ? ? ? ? ? ? minzoom: 0,
? ? ? ? ? ? ? ? ? ? ? ? ? ? maxzoom: 22
? ? ? ? ??}
注意:iserver的切片是以比例尺+X索引+Y索引進行請求的,所以,加載此類圖層,需要使用超圖基于mapbox-gl的擴展。
? ? ??tileImage的請求形式:

3、zxyTileImage?加載http://support.supermap.com.cn:8090/iserver/iClient/forJavaScript/examples/mapboxgl/editor.html#01_tiledMapLayer數(shù)據(jù)源:
sources": {
? ? ? ? ? ? ? ? "raster-tiles": {
? ? ? ? ? ? ? ? ? ? "attribution": attribution,
? ? ? ? ? ? ? ? ? ? "type": "raster",
? ? ? ? ? ? ? ? ? ? "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}'],
? ? ? ? ? ? ? ? ? ? "tileSize": 256
? ? ? ? ? ? ? ? }
? ? ? ? ? ? },
圖層:
? ? ? ? ? ? "layers": [{
? ? ? ? ? ? ? ? "id": "simple-tiles",
? ? ? ? ? ? ? ? "type": "raster",
? ? ? ? ? ? ? ? "source": "raster-tiles",
? ? ? ? ? ? ? ? "minzoom": 0,
? ? ? ? ? ? ? ? "maxzoom": 22
? ? ? ? ? ? }]