@3clear/basegis 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,176 @@
1
+ const c = {
2
+ // 默认显示的基础底图 ID。
3
+ defaultVisibleId: "tianditu-imagery",
4
+ // 默认对应注记层 ID。
5
+ defaultAnnotationId: "tianditu-vector-label",
6
+ // 底图资源列表:天地图 / WMS / WMTS 等都在此统一登记。
7
+ list: [
8
+ {
9
+ id: "tianditu-vector",
10
+ name: "天地图矢量底图",
11
+ description: "天地图官方矢量底图(WMTS)。",
12
+ category: "basemap",
13
+ enabled: !0,
14
+ type: "wmts",
15
+ provider: "tianditu",
16
+ resourceKey: "vector",
17
+ visible: !0,
18
+ engineSupport: ["cesium", "leaflet"]
19
+ },
20
+ {
21
+ id: "tianditu-imagery",
22
+ name: "天地图影像底图",
23
+ description: "天地图官方影像底图(WMTS)。",
24
+ category: "basemap",
25
+ enabled: !0,
26
+ type: "wmts",
27
+ provider: "tianditu",
28
+ resourceKey: "imagery",
29
+ visible: !1,
30
+ engineSupport: ["cesium", "leaflet"]
31
+ },
32
+ {
33
+ id: "tianditu-terrain",
34
+ name: "天地图地形底图",
35
+ description: "天地图官方地形底图(WMTS)。这是地形底图瓦片,不是 Cesium DEM。",
36
+ category: "basemap",
37
+ enabled: !0,
38
+ type: "wmts",
39
+ provider: "tianditu",
40
+ resourceKey: "terrain",
41
+ visible: !1,
42
+ engineSupport: ["cesium", "leaflet"]
43
+ },
44
+ {
45
+ id: "tianditu-vector-label",
46
+ name: "天地图矢量注记",
47
+ description: "天地图矢量注记层(WMTS)。",
48
+ category: "annotation",
49
+ enabled: !0,
50
+ type: "wmts",
51
+ provider: "tianditu",
52
+ resourceKey: "vectorLabel",
53
+ visible: !0,
54
+ engineSupport: ["cesium", "leaflet"]
55
+ },
56
+ {
57
+ id: "tianditu-terrain-label",
58
+ name: "天地图地形注记",
59
+ description: "天地图地形注记层(WMTS)。",
60
+ category: "annotation",
61
+ enabled: !0,
62
+ type: "wmts",
63
+ provider: "tianditu",
64
+ resourceKey: "terrainLabel",
65
+ visible: !1,
66
+ engineSupport: ["cesium", "leaflet"]
67
+ },
68
+ {
69
+ id: "geoserver-wmts-sample",
70
+ name: "GeoServer WMTS 示例",
71
+ description: "GeoServer 发布的 WMTS 底图示例,按项目实际服务地址替换。",
72
+ category: "basemap",
73
+ enabled: !1,
74
+ type: "wmts",
75
+ provider: "custom",
76
+ visible: !1,
77
+ engineSupport: ["cesium", "leaflet"],
78
+ url: "https://example.com/geoserver/gwc/service/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=workspace:layer&STYLE=default&TILEMATRIXSET=EPSG:3857&FORMAT=image/png&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"
79
+ },
80
+ {
81
+ id: "geoserver-wms-sample",
82
+ name: "GeoServer WMS 示例",
83
+ description: "GeoServer 发布的 WMS 底图示例,按项目实际服务地址替换。",
84
+ category: "basemap",
85
+ enabled: !1,
86
+ type: "wms",
87
+ provider: "custom",
88
+ visible: !1,
89
+ engineSupport: ["cesium", "leaflet"],
90
+ serviceUrl: "https://example.com/geoserver/wms",
91
+ layers: "workspace:layer",
92
+ parameters: {
93
+ transparent: !0,
94
+ format: "image/png",
95
+ version: "1.1.1",
96
+ styles: ""
97
+ }
98
+ }
99
+ ],
100
+ providers: {
101
+ // 天地图官方服务配置:每次地图初始化时随机取一个 key。
102
+ tianditu: {
103
+ baseUrl: "https://t{subdomain}.tianditu.gov.cn",
104
+ subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
105
+ tokenPool: [
106
+ "044a56d4f67ef41a3a2597bef7ec6b1e",
107
+ "ff9e3c05564087e2fc9effe99a02fc36"
108
+ ],
109
+ resources: {
110
+ vector: {
111
+ tilePath: "vec_w",
112
+ layerName: "vec"
113
+ },
114
+ vectorLabel: {
115
+ tilePath: "cva_w",
116
+ layerName: "cva"
117
+ },
118
+ imagery: {
119
+ tilePath: "img_w",
120
+ layerName: "img"
121
+ },
122
+ imageryLabel: {
123
+ tilePath: "cia_w",
124
+ layerName: "cia"
125
+ },
126
+ terrain: {
127
+ tilePath: "ter_w",
128
+ layerName: "ter"
129
+ },
130
+ terrainLabel: {
131
+ tilePath: "cta_w",
132
+ layerName: "cta"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ };
138
+ function i(a) {
139
+ var e;
140
+ return ((e = c.providers) == null ? void 0 : e[a]) || null;
141
+ }
142
+ function d(a = "tianditu") {
143
+ var r;
144
+ const e = ((r = i(a)) == null ? void 0 : r.tokenPool) || [];
145
+ if (e.length === 0)
146
+ return "";
147
+ const t = Math.floor(Math.random() * e.length);
148
+ return e[t];
149
+ }
150
+ function m(a = "tianditu") {
151
+ var r;
152
+ const e = ((r = i(a)) == null ? void 0 : r.subdomains) || ["0"], t = Math.floor(Math.random() * e.length);
153
+ return e[t];
154
+ }
155
+ function l(a = "w") {
156
+ return String(a || "w").toLowerCase() === "c" ? "c" : "w";
157
+ }
158
+ function u(a = "", e = "w") {
159
+ const t = String(a || "").replace(/_[cw]$/i, "");
160
+ return t ? `${t}_${l(e)}` : "";
161
+ }
162
+ function p(a = "vector", e = {}) {
163
+ var s;
164
+ const t = i("tianditu"), r = (s = t == null ? void 0 : t.resources) == null ? void 0 : s[a];
165
+ if (!t || !r)
166
+ return "";
167
+ const n = l(e.projection || e.tileMatrixSet), o = u(r.tilePath, n);
168
+ return o ? `${t.baseUrl}/${o}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&FORMAT=tiles&LAYER=${r.layerName}&TILEMATRIXSET=${n}&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk={tk}` : "";
169
+ }
170
+ export {
171
+ p as a,
172
+ c as b,
173
+ i as c,
174
+ m as d,
175
+ d as g
176
+ };