map-ol-utils 0.1.30 → 0.2.0
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.
- package/README.md +223 -45
- package/dist/index.cjs +1907 -1120
- package/dist/index.d.cts +475 -134
- package/dist/index.d.mts +661 -0
- package/dist/index.mjs +1830 -0
- package/dist/tdt-vts/decoder.worker.cjs +46 -0
- package/dist/tdt-vts/decoder.worker.d.cts +1 -0
- package/dist/tdt-vts/decoder.worker.d.mts +1 -0
- package/dist/tdt-vts/decoder.worker.mjs +47 -0
- package/dist/tile-loader-CtZwCurI.mjs +630 -0
- package/dist/tile-loader-D4cn6nMU.cjs +683 -0
- package/package.json +20 -12
- package/dist/index.d.ts +0 -320
- package/dist/index.js +0 -1096
package/package.json
CHANGED
|
@@ -1,39 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "map-ol-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "OpenLayers utilities with browser-side Tianditu private VTS loading and conversion",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"author": "Tomxuetao",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"main": "./dist/index.cjs",
|
|
12
|
-
"module": "./dist/index.
|
|
13
|
-
"types": "./dist/index.d.
|
|
12
|
+
"module": "./dist/index.mjs",
|
|
13
|
+
"types": "./dist/index.d.mts",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"default": "./dist/index.mjs"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.cts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"keywords": [
|
|
22
27
|
"ol",
|
|
23
28
|
"map",
|
|
29
|
+
"mvt",
|
|
30
|
+
"tianditu",
|
|
24
31
|
"openlayers",
|
|
32
|
+
"vector-tile",
|
|
25
33
|
"openlayers-utils"
|
|
26
34
|
],
|
|
27
35
|
"dependencies": {
|
|
28
|
-
"gcoord": "^1.0.7",
|
|
29
36
|
"mitt": "^3.0.1",
|
|
30
|
-
"
|
|
37
|
+
"gcoord": "^1.0.7"
|
|
31
38
|
},
|
|
32
39
|
"peerDependencies": {
|
|
33
|
-
"ol": "
|
|
40
|
+
"ol": "^10.10.0"
|
|
34
41
|
},
|
|
35
42
|
"scripts": {
|
|
36
|
-
"build": "
|
|
37
|
-
"dev": "
|
|
43
|
+
"build": "tsdown",
|
|
44
|
+
"dev": "tsdown --watch",
|
|
45
|
+
"test": "pnpm run build && node --test \"test/**/*.test.ts\""
|
|
38
46
|
}
|
|
39
47
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { Layer, Tile } from 'ol/layer';
|
|
2
|
-
import { Style } from 'ol/style';
|
|
3
|
-
import { Map as Map$1, Overlay, Feature } from 'ol';
|
|
4
|
-
import { CRSTypes } from 'gcoord';
|
|
5
|
-
import * as ol_source from 'ol/source';
|
|
6
|
-
import { Source, XYZ, WMTS } from 'ol/source';
|
|
7
|
-
import { Coordinate } from 'ol/coordinate';
|
|
8
|
-
import { FeatureLike } from 'ol/Feature';
|
|
9
|
-
import { Emitter, EventType } from 'mitt';
|
|
10
|
-
import TileLayer from 'ol/layer/Tile';
|
|
11
|
-
import * as ol_renderer_Layer from 'ol/renderer/Layer';
|
|
12
|
-
import { Options } from 'ol/Overlay';
|
|
13
|
-
import VectorLayer from 'ol/layer/Vector';
|
|
14
|
-
import * as ol_geom from 'ol/geom';
|
|
15
|
-
import { SimpleGeometry, Point } from 'ol/geom';
|
|
16
|
-
import { FitOptions, AnimationOptions } from 'ol/View';
|
|
17
|
-
import { Select } from 'ol/interaction';
|
|
18
|
-
import VectorSource from 'ol/source/Vector';
|
|
19
|
-
import { StyleLike } from 'ol/style/Style';
|
|
20
|
-
import Cluster from 'ol/source/Cluster';
|
|
21
|
-
|
|
22
|
-
interface CustomMap extends Map$1 {
|
|
23
|
-
activeBaseLayer?: string;
|
|
24
|
-
changeBaseLayer?: () => void;
|
|
25
|
-
removeLayerByName?: (name: string) => void;
|
|
26
|
-
getLayerByName?: (name: string) => Layer<Source> | undefined;
|
|
27
|
-
changeLayersByNames?: (activeNames: Array<string>, allLayerNames: Array<string>) => void;
|
|
28
|
-
}
|
|
29
|
-
type GetImgUrl = (name: string, ext?: string) => string;
|
|
30
|
-
type GetImgUrlFn = (baseUrl: string) => GetImgUrl;
|
|
31
|
-
type VectorConfig = {
|
|
32
|
-
key: string;
|
|
33
|
-
zIndex?: number;
|
|
34
|
-
isRaw?: boolean;
|
|
35
|
-
isLine: boolean;
|
|
36
|
-
colorKey?: string;
|
|
37
|
-
layerName?: string;
|
|
38
|
-
openClick?: boolean;
|
|
39
|
-
fillColor?: string;
|
|
40
|
-
isAutoFit?: boolean;
|
|
41
|
-
crsForm?: CRSTypes;
|
|
42
|
-
fillOpacity?: number;
|
|
43
|
-
strokeColor?: string;
|
|
44
|
-
strokeStyle?: string;
|
|
45
|
-
strokeWeight?: number;
|
|
46
|
-
needTransform?: boolean;
|
|
47
|
-
activeFillColor?: string;
|
|
48
|
-
activeStrokeColor?: string;
|
|
49
|
-
activeFillOpacity?: number;
|
|
50
|
-
activeStrokeWeight?: number;
|
|
51
|
-
colorMap?: Map<string, string>;
|
|
52
|
-
};
|
|
53
|
-
type ClusterData = {
|
|
54
|
-
_uuid: string;
|
|
55
|
-
name: string;
|
|
56
|
-
style: number;
|
|
57
|
-
lnglat: Array<number>;
|
|
58
|
-
rawData: {
|
|
59
|
-
[key: string]: any;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
type ClusterConfig = {
|
|
63
|
-
distance: number;
|
|
64
|
-
layerName?: string;
|
|
65
|
-
openClick?: boolean;
|
|
66
|
-
minDistance: number;
|
|
67
|
-
singleStyles: Style[];
|
|
68
|
-
computedRadius?: (size: number) => number;
|
|
69
|
-
buildStyle?: (feature: FeatureLike) => Style;
|
|
70
|
-
};
|
|
71
|
-
type IconConfig = {
|
|
72
|
-
baseUrl: string;
|
|
73
|
-
hasLine?: boolean;
|
|
74
|
-
layerName?: string;
|
|
75
|
-
hasFace?: boolean;
|
|
76
|
-
statusNum?: number;
|
|
77
|
-
isDynamic?: boolean;
|
|
78
|
-
markerIcon: string;
|
|
79
|
-
activeScale?: number;
|
|
80
|
-
isAutoFit?: boolean;
|
|
81
|
-
marksStyles?: Style[];
|
|
82
|
-
offset?: [number, number];
|
|
83
|
-
vectorConfig?: VectorConfig;
|
|
84
|
-
markerSize: [number, number];
|
|
85
|
-
};
|
|
86
|
-
type MassData = {
|
|
87
|
-
_uuid?: string;
|
|
88
|
-
id: string;
|
|
89
|
-
style: number;
|
|
90
|
-
name: string;
|
|
91
|
-
status: string;
|
|
92
|
-
width?: number;
|
|
93
|
-
height?: number;
|
|
94
|
-
crsForm?: CRSTypes;
|
|
95
|
-
rawData: {
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
};
|
|
98
|
-
lnglat: [string, string] | [number, number];
|
|
99
|
-
};
|
|
100
|
-
type WmtsSourceOptions = {
|
|
101
|
-
style?: string;
|
|
102
|
-
format?: string;
|
|
103
|
-
version?: string;
|
|
104
|
-
layerName: string;
|
|
105
|
-
matrixSet?: string;
|
|
106
|
-
};
|
|
107
|
-
declare enum GeometryType {
|
|
108
|
-
LineString = "LineString",
|
|
109
|
-
MultiLineString = "MultiLineString",
|
|
110
|
-
Polygon = "Polygon",
|
|
111
|
-
MultiPolygon = "MultiPolygon",
|
|
112
|
-
Invalid = "Invalid"
|
|
113
|
-
}
|
|
114
|
-
type GeometryCoordinates = Coordinate[] | Coordinate[][] | Coordinate[][][];
|
|
115
|
-
type HzsyType = 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark';
|
|
116
|
-
type ZheJiangType = 'emap' | 'emap_lab' | 'imgmap' | 'imgmap_lab';
|
|
117
|
-
type WorldLayerType = 'vec_c' | 'cva_c' | 'img_c' | 'cia_c' | 'ter_c' | 'cta_c' | 'ibo_c';
|
|
118
|
-
|
|
119
|
-
declare const emitter: Emitter<Record<EventType, any>>;
|
|
120
|
-
|
|
121
|
-
declare const getLayersDataList: () => any[];
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 创建WMTS图层
|
|
125
|
-
* @param serverUrl
|
|
126
|
-
*/
|
|
127
|
-
declare const createWmtsLayer: (serverUrl: string) => (config: WmtsSourceOptions) => Promise<TileLayer>;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* 创建杭州规自地图
|
|
131
|
-
* @param layerName - 'hzsyraster' | 'hzsyvector' | 'hzsyvector_dark'
|
|
132
|
-
*/
|
|
133
|
-
declare const createBaseLayer: (layerName?: HzsyType) => Tile<XYZ>;
|
|
134
|
-
/**
|
|
135
|
-
* 创建全国天地图
|
|
136
|
-
* @param layerName - 图层名称
|
|
137
|
-
* @param tk - 天地图TK
|
|
138
|
-
*/
|
|
139
|
-
declare const createMapWorldLayer: (layerName: WorldLayerType, tk?: string) => Tile<WMTS>;
|
|
140
|
-
/**
|
|
141
|
-
* 浙江省天地图
|
|
142
|
-
* @param layerName - 图层名称
|
|
143
|
-
* @param tk -
|
|
144
|
-
*/
|
|
145
|
-
declare const createZheJiangLayer: (layerName?: ZheJiangType, tk?: string) => Tile<XYZ>;
|
|
146
|
-
/**
|
|
147
|
-
* 根据图层名称获取图层
|
|
148
|
-
* @param name
|
|
149
|
-
*/
|
|
150
|
-
declare const getLayerByName: (name: string) => Layer<ol_source.Source, ol_renderer_Layer.default<any>, {
|
|
151
|
-
[x: string]: any;
|
|
152
|
-
}> | undefined;
|
|
153
|
-
/**
|
|
154
|
-
* 根据图层名称删除图层
|
|
155
|
-
* @param name
|
|
156
|
-
*/
|
|
157
|
-
declare const removeLayerByName: (name: string) => void;
|
|
158
|
-
|
|
159
|
-
declare let instance: CustomMap;
|
|
160
|
-
declare const createMapInstance: (config?: {}) => CustomMap;
|
|
161
|
-
declare const createMap: (config?: {}) => CustomMap;
|
|
162
|
-
declare const disposeMap: () => void;
|
|
163
|
-
declare const getMapInstance: () => CustomMap;
|
|
164
|
-
declare const resetZoomAndCenter: (center?: [number, number]) => void;
|
|
165
|
-
declare const resetMap: (config?: {
|
|
166
|
-
center: [number, number];
|
|
167
|
-
isClearAll: boolean;
|
|
168
|
-
}) => void;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* 移除带指定属性键的 Overlay(默认按 'position')
|
|
172
|
-
* @param key
|
|
173
|
-
*/
|
|
174
|
-
declare const removeOverlays: (key?: string) => void;
|
|
175
|
-
/**
|
|
176
|
-
* 创建动画标注 Overlay
|
|
177
|
-
* @param imgUrl
|
|
178
|
-
* @param data
|
|
179
|
-
*/
|
|
180
|
-
declare const createAnimationMarker: (imgUrl: string, data: MassData) => void;
|
|
181
|
-
/**
|
|
182
|
-
* 创建 Overlay
|
|
183
|
-
* @param config
|
|
184
|
-
*/
|
|
185
|
-
declare const createOverlay: (config?: Options) => Overlay;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* 根据 Array<Coordinate> Fit
|
|
189
|
-
* @param coords
|
|
190
|
-
* @param mapInstance
|
|
191
|
-
* @param fitOptions
|
|
192
|
-
*/
|
|
193
|
-
declare const setFitViewByCoords: (coords: Array<Coordinate>, mapInstance?: CustomMap, fitOptions?: FitOptions | AnimationOptions) => void;
|
|
194
|
-
/**
|
|
195
|
-
* 根据 SimpleGeometry Fit
|
|
196
|
-
* @param geom
|
|
197
|
-
* @param mapInstance
|
|
198
|
-
* @param fitOptions
|
|
199
|
-
*/
|
|
200
|
-
declare const setFitViewByGeom: (geom: SimpleGeometry, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
201
|
-
/**
|
|
202
|
-
* 根据 VectorLayer 要素的四至信息 Fit
|
|
203
|
-
* @param layer
|
|
204
|
-
* @param mapInstance
|
|
205
|
-
* @param fitOptions
|
|
206
|
-
*/
|
|
207
|
-
declare const setFitViewByLayer: (layer: VectorLayer, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* 创建点击交互
|
|
211
|
-
* @param vectorLayer
|
|
212
|
-
*/
|
|
213
|
-
declare const createSelectByLayer: (vectorLayer: VectorLayer) => Select;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* 重置激活的矢量数据(清空 overlay 与各图层选择交互的要素集合)
|
|
217
|
-
*/
|
|
218
|
-
declare const resetActiveVector: () => void;
|
|
219
|
-
/**
|
|
220
|
-
* 移除覆盖物以及所有非底图自定义图层
|
|
221
|
-
*/
|
|
222
|
-
declare const removeAllLayers: () => void;
|
|
223
|
-
/**
|
|
224
|
-
* 重置激活 Feature
|
|
225
|
-
*/
|
|
226
|
-
declare const resetActiveFeature: () => void;
|
|
227
|
-
/**
|
|
228
|
-
* 按 _uuid 激活要素
|
|
229
|
-
* @param uid
|
|
230
|
-
*/
|
|
231
|
-
declare const activeFeatureByUid: (uid: string) => void;
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* 创建业务矢量图层(自动推断线/面,生成默认/激活样式)
|
|
235
|
-
* @param dataList
|
|
236
|
-
* @param config
|
|
237
|
-
*/
|
|
238
|
-
declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<ol_geom.Geometry, {
|
|
239
|
-
[x: string]: any;
|
|
240
|
-
}>>, Feature<ol_geom.Geometry, {
|
|
241
|
-
[x: string]: any;
|
|
242
|
-
}>>;
|
|
243
|
-
/**
|
|
244
|
-
* 追加 Features
|
|
245
|
-
* @param targetLayer
|
|
246
|
-
* @param dataList
|
|
247
|
-
* @param crsForm
|
|
248
|
-
*/
|
|
249
|
-
declare const appendFeaturesByLayer: (targetLayer: VectorLayer, dataList: MassData[], crsForm?: CRSTypes) => void;
|
|
250
|
-
/**
|
|
251
|
-
* 创建面状图层
|
|
252
|
-
* @param dataList
|
|
253
|
-
* @param config
|
|
254
|
-
*/
|
|
255
|
-
declare const createVectorFaceLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<ol_geom.Geometry, {
|
|
256
|
-
[x: string]: any;
|
|
257
|
-
}>>, Feature<ol_geom.Geometry, {
|
|
258
|
-
[x: string]: any;
|
|
259
|
-
}>>;
|
|
260
|
-
/**
|
|
261
|
-
* 创建矢量线图层
|
|
262
|
-
* @param dataList
|
|
263
|
-
* @param config
|
|
264
|
-
*/
|
|
265
|
-
declare const createVectorLineLayer: (dataList: MassData[] | undefined, config: VectorConfig) => VectorLayer<VectorSource<Feature<ol_geom.Geometry, {
|
|
266
|
-
[x: string]: any;
|
|
267
|
-
}>>, Feature<ol_geom.Geometry, {
|
|
268
|
-
[x: string]: any;
|
|
269
|
-
}>>;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* 构建 MassMarks 样式数组(默认段 + 激活段,长度 statusNum * 2)
|
|
273
|
-
*/
|
|
274
|
-
declare const buildMassMarksStyles: (getImgUrlFn: GetImgUrlFn) => (iconConfig: IconConfig) => any[];
|
|
275
|
-
/**
|
|
276
|
-
* 向海量点图层增量添加 Features
|
|
277
|
-
* @param targetLayer
|
|
278
|
-
* @param dataList
|
|
279
|
-
* @param config
|
|
280
|
-
*/
|
|
281
|
-
declare const addFeaturesByLayer: (targetLayer: VectorLayer, dataList: MassData[], config: {
|
|
282
|
-
clear?: boolean;
|
|
283
|
-
}) => void;
|
|
284
|
-
/**
|
|
285
|
-
* 创建 massMarksLayer
|
|
286
|
-
* @param dataList
|
|
287
|
-
* @param styleList
|
|
288
|
-
*/
|
|
289
|
-
declare const createMassMarksLayer: (dataList: MassData[], styleList?: StyleLike[]) => VectorLayer<VectorSource<Feature<Point, {
|
|
290
|
-
[x: string]: any;
|
|
291
|
-
}>>, Feature<Point, {
|
|
292
|
-
[x: string]: any;
|
|
293
|
-
}>>;
|
|
294
|
-
/**
|
|
295
|
-
* 添加 massMarksLayer(按需附带线/面图层)
|
|
296
|
-
* @param getImgUrlFn
|
|
297
|
-
*/
|
|
298
|
-
declare const addMassMarksLayer: (getImgUrlFn: GetImgUrlFn) => (dataList: never[] | undefined, iconConfig: IconConfig, openClick?: boolean) => VectorLayer<VectorSource<Feature<Point, {
|
|
299
|
-
[x: string]: any;
|
|
300
|
-
}>>, Feature<Point, {
|
|
301
|
-
[x: string]: any;
|
|
302
|
-
}>>;
|
|
303
|
-
/**
|
|
304
|
-
* 按选中状态列表更新海量点显隐
|
|
305
|
-
* @param checkedStatusList
|
|
306
|
-
*/
|
|
307
|
-
declare const updateMarksLayersByStatus: (checkedStatusList?: string[]) => MassData[];
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* 创建聚合图层(半径/颜色随聚合数量动态计算)
|
|
311
|
-
* @param dataList
|
|
312
|
-
* @param config
|
|
313
|
-
*/
|
|
314
|
-
declare const createClusterLayer: (dataList: ClusterData[], config: ClusterConfig) => VectorLayer<Cluster<Feature<Point, {
|
|
315
|
-
[x: string]: any;
|
|
316
|
-
}>>, Feature<ol_geom.Geometry, {
|
|
317
|
-
[x: string]: any;
|
|
318
|
-
}>>;
|
|
319
|
-
|
|
320
|
-
export { type ClusterConfig, type ClusterData, type CustomMap, type GeometryCoordinates, GeometryType, type GetImgUrl, type GetImgUrlFn, type HzsyType, type IconConfig, type MassData, type VectorConfig, type WmtsSourceOptions, type WorldLayerType, type ZheJiangType, activeFeatureByUid, addFeaturesByLayer, addMassMarksLayer, appendFeaturesByLayer, buildMassMarksStyles, createAnimationMarker, createBaseLayer, createBusinessLayer, createClusterLayer, createMap, createMapInstance, createMapWorldLayer, createMassMarksLayer, createOverlay, createSelectByLayer, createVectorFaceLayer, createVectorLineLayer, createWmtsLayer, createZheJiangLayer, disposeMap, emitter, getLayerByName, getLayersDataList, getMapInstance, instance, removeAllLayers, removeLayerByName, removeOverlays, resetActiveFeature, resetActiveVector, resetMap, resetZoomAndCenter, setFitViewByCoords, setFitViewByGeom, setFitViewByLayer, updateMarksLayersByStatus };
|