1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| let mapInstance = null; const container = containerHisRef.value as HTMLElement; const webKey = "xx"; mapInstance = new mapboxgl.Map({ container, style: { version: 8, glyphs: "/font/{fontstack}/{range}.pbf", sources: { tianditu: { type: "raster", tiles: [ `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${webKey}`, ], tileSize: 256, }, tianditu_annotation: { type: "raster", tiles: [ `https://t0.tianditu.gov.cn/cva_w/wmts?&service=WMTS&version=1.0.0&request=GetTile&layer=cva&style=default&format=tiles&TileMatrixSet=w&TileMatrix={z}&TileRow={y}&TileCol={x}&tk=${webKey}`, ], tileSize: 256, }, }, layers: [{ id: "tianditu", type: "raster", source: "tianditu", }, { id: "tianditu_annotation", type: "raster", source: "tianditu_annotation", }, ], }, center: [121, 31], zoom: 17, pitch: 20, });
|