一個(gè)GIS項(xiàng)目用到了antv/L7,本來打算用leaflet,但上個(gè)相似的項(xiàng)目用了antv/L7,這個(gè)項(xiàng)目就繼續(xù)antv/L7了。
客戶要求用google影像加注記的底圖,且要離線使用,因此一記。
項(xiàng)目是react框架的,因此用到了@antv/l7-react。
詳細(xì)代碼如下:
<MapboxScene
className="my-map"
option={{
logoVisible: false,
}}
map={{
center: [100.3, 38.5],
zoom: 6,
style: {
version: 8,
sources: {
'raster-tiles': {
type: 'raster',
tiles: [
// mt(0—3) Google地圖使用了四個(gè)服務(wù)地址
// lyrs=
// m:路線圖
// t:地形圖
// p:帶標(biāo)簽的地形圖
// s:衛(wèi)星圖
// y:帶標(biāo)簽的衛(wèi)星圖
// h:標(biāo)簽層(路名、地名等)
'https://mt1.google.cn/maps/vt?lyrs=y%40721&hl=zh-CN&gl=CN&x={x}&y={y}&z={z}',
],
tileSize: 256,
},
},
layers: [
{
id: 'google',
type: 'raster',
source: 'raster-tiles',
// minZoom: 0,
// "maxzoom": 18
},
],
},
}}
style={{
height: '100vh',
}}
/>