nicecode-v2/packages/map/es/constants.js

47 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export var mapboxAccessToken = 'pk.eyJ1IjoiZGluZ2xpMTIzIiwiYSI6ImNra204ODhjczBobTgyeHJ6MmJpZHMxNWgifQ.NbKrXh_hb2gvjr5CEMDnyQ';
export var MAP_CENTER = {
longitude: 120.2667694313269,
latitude: 30.180942826533766
}; //地图中心
var MapUrl = 'http://10.0.0.120:30003/map';
export var defaultMapConfig = {
mapboxAccessToken: mapboxAccessToken,
maxZoom: 18,
minZoom: 4,
dragRotate: false,
mapStyle: {
version: 8,
name: 'Mapbox Streets',
// sprite: `${location.origin}/mapbox/sprite`, // 地图图标
glyphs: 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf',
// 字体
sources: {
//数据源
'osm-tiles': {
type: 'raster',
//栅格切片。vector:矢量切片
// Z-瓦片层级一般支持0-18级越大代表越清晰
// X-瓦片列号从西向东0->360依次012……
// Y-瓦片行号从北向南有些也可能是从南向北依次012……
tiles: ["".concat(MapUrl, "/api/tilesets/mapfile/{z}/{x}/{y}.png")],
//在线地址先写死120
tileSize: 256 //切片的最小展示尺寸(可选,单位:像素,默认值为 512即 1024/2
}
},
layers: [
// 图层。图层指定了如何渲染数据源提供的数据
{
id: 'zhstLayer',
//唯一id
type: 'raster',
//类型 栅格。circlesymbolline...
source: 'osm-tiles',
// 'source-layer': 'osmtiles',//数据源必须是type:vector
minZoom: 4,
//最小层级
maxZoom: 17,
//最大层级
renderingMode: '2d'
}]
}
};