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

82 lines
2.7 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.

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/constants.ts
var constants_exports = {};
__export(constants_exports, {
MAP_CENTER: () => MAP_CENTER,
defaultMapConfig: () => defaultMapConfig,
mapboxAccessToken: () => mapboxAccessToken
});
module.exports = __toCommonJS(constants_exports);
var mapboxAccessToken = "pk.eyJ1IjoiZGluZ2xpMTIzIiwiYSI6ImNra204ODhjczBobTgyeHJ6MmJpZHMxNWgifQ.NbKrXh_hb2gvjr5CEMDnyQ";
var MAP_CENTER = {
longitude: 120.2667694313269,
latitude: 30.180942826533766
};
var MapUrl = "http://10.0.0.120:30003/map";
var defaultMapConfig = {
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: [`${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"
}
]
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
MAP_CENTER,
defaultMapConfig,
mapboxAccessToken
});