geo-types-cz 1.0.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/LICENSE +21 -0
- package/README.md +297 -0
- package/dist/bbox.d.ts +25 -0
- package/dist/bbox.d.ts.map +1 -0
- package/dist/bbox.js +98 -0
- package/dist/bbox.js.map +1 -0
- package/dist/crs.d.ts +37 -0
- package/dist/crs.d.ts.map +1 -0
- package/dist/crs.js +81 -0
- package/dist/crs.js.map +1 -0
- package/dist/extensions.d.ts +150 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +63 -0
- package/dist/extensions.js.map +1 -0
- package/dist/feature.d.ts +29 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/feature.js +42 -0
- package/dist/feature.js.map +1 -0
- package/dist/geometry.d.ts +58 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +78 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/dist/utils.d.ts +19 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +238 -0
- package/dist/utils.js.map +1 -0
- package/package.json +40 -0
- package/src/bbox.ts +142 -0
- package/src/crs.ts +107 -0
- package/src/extensions.ts +231 -0
- package/src/feature.ts +70 -0
- package/src/geometry.ts +138 -0
- package/src/index.ts +156 -0
- package/src/utils.ts +289 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 扩展的GIS类型定义
|
|
3
|
+
* 包括样式、符号化、图层等前端GIS开发中常用的类型
|
|
4
|
+
*/
|
|
5
|
+
import { Feature, FeatureCollection, FeatureType, Properties } from './feature';
|
|
6
|
+
import { Geometry } from './geometry';
|
|
7
|
+
export type Color = string;
|
|
8
|
+
export interface Style {
|
|
9
|
+
fill?: {
|
|
10
|
+
color?: Color;
|
|
11
|
+
opacity?: number;
|
|
12
|
+
};
|
|
13
|
+
stroke?: {
|
|
14
|
+
color?: Color;
|
|
15
|
+
width?: number;
|
|
16
|
+
opacity?: number;
|
|
17
|
+
dashArray?: number[];
|
|
18
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
19
|
+
lineJoin?: 'miter' | 'round' | 'bevel';
|
|
20
|
+
};
|
|
21
|
+
marker?: {
|
|
22
|
+
size?: number;
|
|
23
|
+
color?: Color;
|
|
24
|
+
opacity?: number;
|
|
25
|
+
symbol?: 'circle' | 'square' | 'triangle' | 'star' | 'cross' | 'diamond';
|
|
26
|
+
};
|
|
27
|
+
text?: {
|
|
28
|
+
field?: string;
|
|
29
|
+
font?: string;
|
|
30
|
+
size?: number;
|
|
31
|
+
color?: Color;
|
|
32
|
+
haloColor?: Color;
|
|
33
|
+
haloWidth?: number;
|
|
34
|
+
offset?: [number, number];
|
|
35
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
36
|
+
baseline?: 'top' | 'middle' | 'bottom';
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface StyledFeature<G extends Geometry = Geometry, P extends Properties = Properties> extends Feature<G, P> {
|
|
40
|
+
style?: Style;
|
|
41
|
+
}
|
|
42
|
+
export interface StyledFeatureCollection<G extends Geometry = Geometry, P extends Properties = Properties> {
|
|
43
|
+
type: FeatureType.FeatureCollection;
|
|
44
|
+
features: StyledFeature<G, P>[];
|
|
45
|
+
style?: Style;
|
|
46
|
+
bbox?: [number, number, number, number] | [number, number, number, number, number, number];
|
|
47
|
+
}
|
|
48
|
+
export declare enum LayerType {
|
|
49
|
+
Vector = "vector",
|
|
50
|
+
Raster = "raster",
|
|
51
|
+
TileLayer = "tile"
|
|
52
|
+
}
|
|
53
|
+
export interface BaseLayer {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
type: LayerType;
|
|
57
|
+
visible?: boolean;
|
|
58
|
+
opacity?: number;
|
|
59
|
+
minZoom?: number;
|
|
60
|
+
maxZoom?: number;
|
|
61
|
+
metadata?: {
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface VectorLayer extends BaseLayer {
|
|
66
|
+
type: LayerType.Vector;
|
|
67
|
+
data: FeatureCollection | StyledFeatureCollection;
|
|
68
|
+
style?: Style;
|
|
69
|
+
}
|
|
70
|
+
export interface RasterLayer extends BaseLayer {
|
|
71
|
+
type: LayerType.Raster;
|
|
72
|
+
url: string;
|
|
73
|
+
bounds?: [number, number, number, number];
|
|
74
|
+
}
|
|
75
|
+
export interface TileLayer extends BaseLayer {
|
|
76
|
+
type: LayerType.TileLayer;
|
|
77
|
+
url: string;
|
|
78
|
+
attribution?: string;
|
|
79
|
+
subdomains?: string[];
|
|
80
|
+
}
|
|
81
|
+
export type Layer = VectorLayer | RasterLayer | TileLayer;
|
|
82
|
+
export interface MapView {
|
|
83
|
+
center: [number, number];
|
|
84
|
+
zoom: number;
|
|
85
|
+
bearing?: number;
|
|
86
|
+
pitch?: number;
|
|
87
|
+
bounds?: [number, number, number, number];
|
|
88
|
+
}
|
|
89
|
+
export interface ClusterConfig {
|
|
90
|
+
enabled: boolean;
|
|
91
|
+
distance: number;
|
|
92
|
+
maxZoom: number;
|
|
93
|
+
minPoints?: number;
|
|
94
|
+
style?: {
|
|
95
|
+
cluster?: Style;
|
|
96
|
+
clusterText?: {
|
|
97
|
+
font?: string;
|
|
98
|
+
size?: number;
|
|
99
|
+
color?: string;
|
|
100
|
+
haloColor?: string;
|
|
101
|
+
haloWidth?: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export interface MapConfig {
|
|
106
|
+
container: string | any;
|
|
107
|
+
view: MapView;
|
|
108
|
+
layers?: Layer[];
|
|
109
|
+
controls?: {
|
|
110
|
+
zoom?: boolean;
|
|
111
|
+
attribution?: boolean;
|
|
112
|
+
scale?: boolean;
|
|
113
|
+
fullscreen?: boolean;
|
|
114
|
+
};
|
|
115
|
+
interactions?: {
|
|
116
|
+
dragPan?: boolean;
|
|
117
|
+
scrollZoom?: boolean;
|
|
118
|
+
doubleClickZoom?: boolean;
|
|
119
|
+
keyboard?: boolean;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export declare enum SpatialQueryType {
|
|
123
|
+
Intersects = "intersects",
|
|
124
|
+
Contains = "contains",
|
|
125
|
+
Within = "within",
|
|
126
|
+
Touches = "touches",
|
|
127
|
+
Crosses = "crosses",
|
|
128
|
+
Overlaps = "overlaps"
|
|
129
|
+
}
|
|
130
|
+
export interface SpatialQuery {
|
|
131
|
+
type: SpatialQueryType;
|
|
132
|
+
geometry: Geometry;
|
|
133
|
+
buffer?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface AttributeQuery {
|
|
136
|
+
field: string;
|
|
137
|
+
operator: '=' | '!=' | '>' | '<' | '>=' | '<=' | 'like' | 'in' | 'not in';
|
|
138
|
+
value: any;
|
|
139
|
+
}
|
|
140
|
+
export interface Query {
|
|
141
|
+
spatial?: SpatialQuery;
|
|
142
|
+
attributes?: AttributeQuery[];
|
|
143
|
+
logic?: 'and' | 'or';
|
|
144
|
+
}
|
|
145
|
+
export declare function isVectorLayer(layer: Layer): layer is VectorLayer;
|
|
146
|
+
export declare function isRasterLayer(layer: Layer): layer is RasterLayer;
|
|
147
|
+
export declare function isTileLayer(layer: Layer): layer is TileLayer;
|
|
148
|
+
export declare function createVectorLayer(id: string, name: string, data: FeatureCollection, style?: Style): VectorLayer;
|
|
149
|
+
export declare function createTileLayer(id: string, name: string, url: string, attribution?: string): TileLayer;
|
|
150
|
+
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,Q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AAI,SAAS,CAE5D;AAGD,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,iBAAiB,EACvB,KAAK,CAAC,EAAE,KAAK,GACZ,WAAW,CAUb;AAED,wBAAgB,eAAe,CAC7B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,MAAM,GACnB,SAAS,CAUX"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 扩展的GIS类型定义
|
|
4
|
+
* 包括样式、符号化、图层等前端GIS开发中常用的类型
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SpatialQueryType = exports.LayerType = void 0;
|
|
8
|
+
exports.isVectorLayer = isVectorLayer;
|
|
9
|
+
exports.isRasterLayer = isRasterLayer;
|
|
10
|
+
exports.isTileLayer = isTileLayer;
|
|
11
|
+
exports.createVectorLayer = createVectorLayer;
|
|
12
|
+
exports.createTileLayer = createTileLayer;
|
|
13
|
+
// 图层类型
|
|
14
|
+
var LayerType;
|
|
15
|
+
(function (LayerType) {
|
|
16
|
+
LayerType["Vector"] = "vector";
|
|
17
|
+
LayerType["Raster"] = "raster";
|
|
18
|
+
LayerType["TileLayer"] = "tile";
|
|
19
|
+
})(LayerType || (exports.LayerType = LayerType = {}));
|
|
20
|
+
// 空间查询类型
|
|
21
|
+
var SpatialQueryType;
|
|
22
|
+
(function (SpatialQueryType) {
|
|
23
|
+
SpatialQueryType["Intersects"] = "intersects";
|
|
24
|
+
SpatialQueryType["Contains"] = "contains";
|
|
25
|
+
SpatialQueryType["Within"] = "within";
|
|
26
|
+
SpatialQueryType["Touches"] = "touches";
|
|
27
|
+
SpatialQueryType["Crosses"] = "crosses";
|
|
28
|
+
SpatialQueryType["Overlaps"] = "overlaps";
|
|
29
|
+
})(SpatialQueryType || (exports.SpatialQueryType = SpatialQueryType = {}));
|
|
30
|
+
// 类型守卫函数
|
|
31
|
+
function isVectorLayer(layer) {
|
|
32
|
+
return layer.type === LayerType.Vector;
|
|
33
|
+
}
|
|
34
|
+
function isRasterLayer(layer) {
|
|
35
|
+
return layer.type === LayerType.Raster;
|
|
36
|
+
}
|
|
37
|
+
function isTileLayer(layer) {
|
|
38
|
+
return layer.type === LayerType.TileLayer;
|
|
39
|
+
}
|
|
40
|
+
// 工具函数
|
|
41
|
+
function createVectorLayer(id, name, data, style) {
|
|
42
|
+
return {
|
|
43
|
+
id,
|
|
44
|
+
name,
|
|
45
|
+
type: LayerType.Vector,
|
|
46
|
+
data,
|
|
47
|
+
style,
|
|
48
|
+
visible: true,
|
|
49
|
+
opacity: 1
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function createTileLayer(id, name, url, attribution) {
|
|
53
|
+
return {
|
|
54
|
+
id,
|
|
55
|
+
name,
|
|
56
|
+
type: LayerType.TileLayer,
|
|
57
|
+
url,
|
|
58
|
+
attribution,
|
|
59
|
+
visible: true,
|
|
60
|
+
opacity: 1
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../src/extensions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsLH,sCAEC;AAED,sCAEC;AAED,kCAEC;AAGD,8CAeC;AAED,0CAeC;AAtKD,OAAO;AACP,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;IACjB,+BAAkB,CAAA;AACpB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAoFD,SAAS;AACT,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,yCAAqB,CAAA;IACrB,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,yCAAqB,CAAA;AACvB,CAAC,EAPW,gBAAgB,gCAAhB,gBAAgB,QAO3B;AAuBD,SAAS;AACT,SAAgB,aAAa,CAAC,KAAY;IACxC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,MAAM,CAAC;AACzC,CAAC;AAED,SAAgB,aAAa,CAAC,KAAY;IACxC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,MAAM,CAAC;AACzC,CAAC;AAED,SAAgB,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,SAAS,CAAC;AAC5C,CAAC;AAED,OAAO;AACP,SAAgB,iBAAiB,CAC/B,EAAU,EACV,IAAY,EACZ,IAAuB,EACvB,KAAa;IAEb,OAAO;QACL,EAAE;QACF,IAAI;QACJ,IAAI,EAAE,SAAS,CAAC,MAAM;QACtB,IAAI;QACJ,KAAK;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,CAAC;KACX,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAC7B,EAAU,EACV,IAAY,EACZ,GAAW,EACX,WAAoB;IAEpB,OAAO;QACL,EAAE;QACF,IAAI;QACJ,IAAI,EAAE,SAAS,CAAC,SAAS;QACzB,GAAG;QACH,WAAW;QACX,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,CAAC;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoJSON要素类型定义
|
|
3
|
+
*/
|
|
4
|
+
import { Geometry } from './geometry';
|
|
5
|
+
export declare enum FeatureType {
|
|
6
|
+
Feature = "Feature",
|
|
7
|
+
FeatureCollection = "FeatureCollection"
|
|
8
|
+
}
|
|
9
|
+
export type Properties = {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
} | null;
|
|
12
|
+
export interface Feature<G extends Geometry = Geometry, P extends Properties = Properties> {
|
|
13
|
+
type: FeatureType.Feature;
|
|
14
|
+
geometry: G | null;
|
|
15
|
+
properties: P;
|
|
16
|
+
id?: string | number;
|
|
17
|
+
bbox?: [number, number, number, number] | [number, number, number, number, number, number];
|
|
18
|
+
}
|
|
19
|
+
export interface FeatureCollection<G extends Geometry = Geometry, P extends Properties = Properties> {
|
|
20
|
+
type: FeatureType.FeatureCollection;
|
|
21
|
+
features: Feature<G, P>[];
|
|
22
|
+
bbox?: [number, number, number, number] | [number, number, number, number, number, number];
|
|
23
|
+
}
|
|
24
|
+
export type GeoJSONObject = Geometry | Feature | FeatureCollection;
|
|
25
|
+
export declare function isFeature(obj: GeoJSONObject): obj is Feature;
|
|
26
|
+
export declare function isFeatureCollection(obj: GeoJSONObject): obj is FeatureCollection;
|
|
27
|
+
export declare function createFeature<G extends Geometry, P extends Properties>(geometry: G | null, properties: P, id?: string | number): Feature<G, P>;
|
|
28
|
+
export declare function createFeatureCollection<G extends Geometry, P extends Properties>(features: Feature<G, P>[]): FeatureCollection<G, P>;
|
|
29
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,iBAAiB,sBAAsB;CACxC;AAGD,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAAC;AAGvD,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,CAAC,SAAS,UAAU,GAAG,UAAU;IACvF,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC;IAC1B,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC;IACnB,UAAU,EAAE,CAAC,CAAC;IACd,EAAE,CAAC,EAA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ist/feature.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GeoJSON要素类型定义
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FeatureType = void 0;
|
|
7
|
+
exports.isFeature = isFeature;
|
|
8
|
+
exports.isFeatureCollection = isFeatureCollection;
|
|
9
|
+
exports.createFeature = createFeature;
|
|
10
|
+
exports.createFeatureCollection = createFeatureCollection;
|
|
11
|
+
// 要素类型枚举
|
|
12
|
+
var FeatureType;
|
|
13
|
+
(function (FeatureType) {
|
|
14
|
+
FeatureType["Feature"] = "Feature";
|
|
15
|
+
FeatureType["FeatureCollection"] = "FeatureCollection";
|
|
16
|
+
})(FeatureType || (exports.FeatureType = FeatureType = {}));
|
|
17
|
+
// 类型守卫函数
|
|
18
|
+
function isFeature(obj) {
|
|
19
|
+
return obj.type === FeatureType.Feature;
|
|
20
|
+
}
|
|
21
|
+
function isFeatureCollection(obj) {
|
|
22
|
+
return obj.type === FeatureType.FeatureCollection;
|
|
23
|
+
}
|
|
24
|
+
// 工具函数
|
|
25
|
+
function createFeature(geometry, properties, id) {
|
|
26
|
+
const feature = {
|
|
27
|
+
type: FeatureType.Feature,
|
|
28
|
+
geometry,
|
|
29
|
+
properties
|
|
30
|
+
};
|
|
31
|
+
if (id !== undefined) {
|
|
32
|
+
feature.id = id;
|
|
33
|
+
}
|
|
34
|
+
return feature;
|
|
35
|
+
}
|
|
36
|
+
function createFeatureCollection(features) {
|
|
37
|
+
return {
|
|
38
|
+
type: FeatureType.FeatureCollection,
|
|
39
|
+
features
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAiCH,8BAEC;AAED,kDAEC;AAGD,sCAgBC;AAED,0DAOC;AA/DD,SAAS;AACT,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,sDAAuC,CAAA;AACzC,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAwBD,SAAS;AACT,SAAgB,SAAS,CAAC,GAAkB;IAC1C,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,OAAO,CAAC;AAC1C,CAAC;AAED,SAAgB,mBAAmB,CAAC,GAAkB;IACpD,OAAO,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,iBAAiB,CAAC;AACpD,CAAC;AAED,OAAO;AACP,SAAgB,aAAa,CAC3B,QAAkB,EAClB,UAAa,EACb,EAAoB;IAEpB,MAAM,OAAO,GAAkB;QAC7B,IAAI,EAAE,WAAW,CAAC,OAAO;QACzB,QAAQ;QACR,UAAU;KACX,CAAC;IAEF,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,uBAAuB,CACrC,QAAyB;IAEzB,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,iBAAiB;QACnC,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GeoJSON几何类型定义
|
|
3
|
+
* 基于RFC 7946标准
|
|
4
|
+
*/
|
|
5
|
+
export type Position = [number, number] | [number, number, number];
|
|
6
|
+
export declare enum GeometryType {
|
|
7
|
+
Point = "Point",
|
|
8
|
+
LineString = "LineString",
|
|
9
|
+
Polygon = "Polygon",
|
|
10
|
+
MultiPoint = "MultiPoint",
|
|
11
|
+
MultiLineString = "MultiLineString",
|
|
12
|
+
MultiPolygon = "MultiPolygon",
|
|
13
|
+
GeometryCollection = "GeometryCollection"
|
|
14
|
+
}
|
|
15
|
+
export interface BaseGeometry {
|
|
16
|
+
type: GeometryType;
|
|
17
|
+
bbox?: [number, number, number, number] | [number, number, number, number, number, number];
|
|
18
|
+
}
|
|
19
|
+
export interface Point extends BaseGeometry {
|
|
20
|
+
type: GeometryType.Point;
|
|
21
|
+
coordinates: Position;
|
|
22
|
+
}
|
|
23
|
+
export interface LineString extends BaseGeometry {
|
|
24
|
+
type: GeometryType.LineString;
|
|
25
|
+
coordinates: Position[];
|
|
26
|
+
}
|
|
27
|
+
export interface Polygon extends BaseGeometry {
|
|
28
|
+
type: GeometryType.Polygon;
|
|
29
|
+
coordinates: Position[][];
|
|
30
|
+
}
|
|
31
|
+
export interface MultiPoint extends BaseGeometry {
|
|
32
|
+
type: GeometryType.MultiPoint;
|
|
33
|
+
coordinates: Position[];
|
|
34
|
+
}
|
|
35
|
+
export interface MultiLineString extends BaseGeometry {
|
|
36
|
+
type: GeometryType.MultiLineString;
|
|
37
|
+
coordinates: Position[][];
|
|
38
|
+
}
|
|
39
|
+
export interface MultiPolygon extends BaseGeometry {
|
|
40
|
+
type: GeometryType.MultiPolygon;
|
|
41
|
+
coordinates: Position[][][];
|
|
42
|
+
}
|
|
43
|
+
export interface GeometryCollection extends BaseGeometry {
|
|
44
|
+
type: GeometryType.GeometryCollection;
|
|
45
|
+
geometries: Geometry[];
|
|
46
|
+
}
|
|
47
|
+
export type Geometry = Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon | GeometryCollection;
|
|
48
|
+
export declare function isPoint(geometry: Geometry): geometry is Point;
|
|
49
|
+
export declare function isLineString(geometry: Geometry): geometry is LineString;
|
|
50
|
+
export declare function isPolygon(geometry: Geometry): geometry is Polygon;
|
|
51
|
+
export declare function isMultiPoint(geometry: Geometry): geometry is MultiPoint;
|
|
52
|
+
export declare function isMultiLineString(geometry: Geometry): geometry is MultiLineString;
|
|
53
|
+
export declare function isMultiPolygon(geometry: Geometry): geometry is MultiPolygon;
|
|
54
|
+
export declare function isGeometryCollection(geometry: Geometry): geometry is GeometryCollection;
|
|
55
|
+
export declare function validateCoordinates(coordinates: readonly [number, number]): boolean;
|
|
56
|
+
export declare function validateGeometry(geometry: any): boolean;
|
|
57
|
+
export declare function validateFeatureGeometry(feature: any): boolean;
|
|
58
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../src/geometry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAGnE,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,kBAAkB,uBAAuB;CAC1C;AAGD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5F;AAGD,MAAM,WAAW,KAAM,SAAQ,YAAY;IACzC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC;IACzB,WAAW,EAAE,QAAQ,CAAC;CACvB;AAGD,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,IAAI,EAAE,YAAY,CAAC,UAAU,CAAC;IAC9B,WAAW,EAAE,QAAQ,EAAE,CAAC;CACzB;AAGD,MAAM,WAAW,OAAQ,SAAQ,YAAY;IAC3C,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC;IAC3B,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC;CAC3B;AAGD,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,IAAI,EAAE,YAAY,CAAC,UAAU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,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAiBvD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAE7D"}
|
package/dist/geometry.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GeoJSON几何类型定义
|
|
4
|
+
* 基于RFC 7946标准
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.GeometryType = void 0;
|
|
8
|
+
exports.isPoint = isPoint;
|
|
9
|
+
exports.isLineString = isLineString;
|
|
10
|
+
exports.isPolygon = isPolygon;
|
|
11
|
+
exports.isMultiPoint = isMultiPoint;
|
|
12
|
+
exports.isMultiLineString = isMultiLineString;
|
|
13
|
+
exports.isMultiPolygon = isMultiPolygon;
|
|
14
|
+
exports.isGeometryCollection = isGeometryCollection;
|
|
15
|
+
exports.validateCoordinates = validateCoordinates;
|
|
16
|
+
exports.validateGeometry = validateGeometry;
|
|
17
|
+
exports.validateFeatureGeometry = validateFeatureGeometry;
|
|
18
|
+
const feature_1 = require("./feature");
|
|
19
|
+
// 几何类型枚举
|
|
20
|
+
var GeometryType;
|
|
21
|
+
(function (GeometryType) {
|
|
22
|
+
GeometryType["Point"] = "Point";
|
|
23
|
+
GeometryType["LineString"] = "LineString";
|
|
24
|
+
GeometryType["Polygon"] = "Polygon";
|
|
25
|
+
GeometryType["MultiPoint"] = "MultiPoint";
|
|
26
|
+
GeometryType["MultiLineString"] = "MultiLineString";
|
|
27
|
+
GeometryType["MultiPolygon"] = "MultiPolygon";
|
|
28
|
+
GeometryType["GeometryCollection"] = "GeometryCollection";
|
|
29
|
+
})(GeometryType || (exports.GeometryType = GeometryType = {}));
|
|
30
|
+
// 几何类型守卫函数
|
|
31
|
+
function isPoint(geometry) {
|
|
32
|
+
return geometry.type === GeometryType.Point;
|
|
33
|
+
}
|
|
34
|
+
function isLineString(geometry) {
|
|
35
|
+
return geometry.type === GeometryType.LineString;
|
|
36
|
+
}
|
|
37
|
+
function isPolygon(geometry) {
|
|
38
|
+
return geometry.type === GeometryType.Polygon;
|
|
39
|
+
}
|
|
40
|
+
function isMultiPoint(geometry) {
|
|
41
|
+
return geometry.type === GeometryType.MultiPoint;
|
|
42
|
+
}
|
|
43
|
+
function isMultiLineString(geometry) {
|
|
44
|
+
return geometry.type === GeometryType.MultiLineString;
|
|
45
|
+
}
|
|
46
|
+
function isMultiPolygon(geometry) {
|
|
47
|
+
return geometry.type === GeometryType.MultiPolygon;
|
|
48
|
+
}
|
|
49
|
+
function isGeometryCollection(geometry) {
|
|
50
|
+
return geometry.type === GeometryType.GeometryCollection;
|
|
51
|
+
}
|
|
52
|
+
// 经纬度校验
|
|
53
|
+
function validateCoordinates(coordinates) {
|
|
54
|
+
const [lon, lat] = coordinates;
|
|
55
|
+
return lon >= -180 && lon <= 180 && lat >= -90 && lat <= 90;
|
|
56
|
+
}
|
|
57
|
+
//集合体验证
|
|
58
|
+
function validateGeometry(geometry) {
|
|
59
|
+
if (!geometry || !geometry.type)
|
|
60
|
+
return false;
|
|
61
|
+
switch (geometry.type) {
|
|
62
|
+
case 'Point':
|
|
63
|
+
return isPoint(geometry) && validateCoordinates(geometry.coordinates);
|
|
64
|
+
case 'LineString':
|
|
65
|
+
return isLineString(geometry) &&
|
|
66
|
+
geometry.coordinates.every((coord) => validateCoordinates(coord));
|
|
67
|
+
case 'Polygon':
|
|
68
|
+
return isPolygon(geometry) &&
|
|
69
|
+
geometry.coordinates.every((ring) => ring.every((coord) => validateCoordinates(coord)));
|
|
70
|
+
default:
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// 验证要素的几何体
|
|
75
|
+
function validateFeatureGeometry(feature) {
|
|
76
|
+
return (0, feature_1.isFeature)(feature) && validateGeometry(feature.geometry);
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 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definitions for GeoJSON and extended GIS types
|
|
4
|
+
*
|
|
5
|
+
* 这个包提供了完整的GeoJSON类型定义以及扩展的GIS类型,
|
|
6
|
+
* 适用于前端地理信息系统开发。
|
|
7
|
+
*/
|
|
8
|
+
export { Position, GeometryType, BaseGeometry, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection, Geometry, isPoint, isLineString, isPolygon, isMultiPoint, isMultiLineString, isMultiPolygon, isGeometryCollection, validateCoordinates, validateFeatureGeometry } from './geometry';
|
|
9
|
+
export { FeatureType, Properties, Feature, FeatureCollection, GeoJSONObject, isFeature, isFeatureCollection, createFeature, createFeatureCollection } from './feature';
|
|
10
|
+
export { CRSType, BaseCRS, NamedCRS, LinkedCRS, CRS, CommonCRS, isNamedCRS, isLinkedCRS, createNamedCRS, createLinkedCRS } from './crs';
|
|
11
|
+
export { BBox2D, BBox3D, BBox, BoundingBox, is2DBBox, is3DBBox, createBBox2D, createBBox3D, bboxToObject, objectToBBox, unionBBox, isPositionInBBox, getBBoxCenter } from './bbox';
|
|
12
|
+
export { Color, Style, StyledFeature, StyledFeatureCollection, LayerType, BaseLayer, VectorLayer, RasterLayer, TileLayer, Layer, MapView, MapConfig, SpatialQueryType, SpatialQuery, AttributeQuery, Query, isVectorLayer, isRasterLayer, isTileLayer, ClusterConfig } from './extensions';
|
|
13
|
+
export { degreesToRadians, radiansToDegrees, calculateDistance, calculateBearing, calculateDestination, calculateLineLength, calculatePolygonArea, calculateGeometryBBox, calculateFeatureCollectionBBox, simplifyLineString, createBuffer } from './utils';
|
|
14
|
+
export declare const VERSION = "1.0.0";
|
|
15
|
+
declare const _default: {
|
|
16
|
+
VERSION: string;
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
19
|
+
/**
|
|
20
|
+
* 使用示例:
|
|
21
|
+
*
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import {
|
|
24
|
+
* Point,
|
|
25
|
+
* Feature,
|
|
26
|
+
* FeatureCollection,
|
|
27
|
+
* createFeature,
|
|
28
|
+
* calculateDistance
|
|
29
|
+
* } from 'geo-types-cz';
|
|
30
|
+
*
|
|
31
|
+
* // 创建点几何
|
|
32
|
+
* const point: Point = {
|
|
33
|
+
* type: 'Point',
|
|
34
|
+
* coordinates: [116.3974, 39.9093] // 北京天安门
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* // 创建要素
|
|
38
|
+
* const feature = createFeature(point, {
|
|
39
|
+
* name: '天安门',
|
|
40
|
+
* city: '北京'
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // 计算两点间距离
|
|
44
|
+
* const distance = calculateDistance(
|
|
45
|
+
* [116.3974, 39.9093], // 天安门
|
|
46
|
+
* [121.4737, 31.2304] // 上海外滩
|
|
47
|
+
* );
|
|
48
|
+
*
|
|
49
|
+
* console.log(`北京到上海的距离: ${Math.round(distance / 1000)}公里`);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,WAAW,EACX,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACxB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,SAAS,EACT,GAAG,EACH,SAAS,EACT,UAAU,EACV,WAAW,EACX,cAAc,EACd,eAAe,EAChB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACd,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,KAAK,EACL,KAAK,EACL,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,KAAK,EACL,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,kBAAkB,EAClB,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,OAAO,UAAU,CAAC;;;;AAG/B,wBAEE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* geo-types-cz
|
|
4
|
+
* Complete TypeScript type definitions for GeoJSON and extended GIS types
|
|
5
|
+
*
|
|
6
|
+
* 这个包提供了完整的GeoJSON类型定义以及扩展的GIS类型,
|
|
7
|
+
* 适用于前端地理信息系统开发。
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.VERSION = exports.createBuffer = exports.simplifyLineString = exports.calculateFeatureCollectionBBox = exports.calculateGeometryBBox = exports.calculatePolygonArea = exports.calculateLineLength = exports.calculateDestination = exports.calculateBearing = exports.calculateDistance = exports.radiansToDegrees = exports.degreesToRadians = exports.isTileLayer = exports.isRasterLayer = exports.isVectorLayer = exports.SpatialQueryType = exports.LayerType = exports.getBBoxCenter = exports.isPositionInBBox = exports.unionBBox = exports.objectToBBox = exports.bboxToObject = exports.createBBox3D = exports.createBBox2D = exports.is3DBBox = exports.is2DBBox = exports.createLinkedCRS = exports.createNamedCRS = exports.isLinkedCRS = exports.isNamedCRS = exports.CommonCRS = exports.CRSType = exports.createFeatureCollection = exports.createFeature = exports.isFeatureCollection = exports.isFeature = exports.FeatureType = exports.validateFeatureGeometry = exports.validateCoordinates = exports.isGeometryCollection = exports.isMultiPolygon = exports.isMultiLineString = exports.isMultiPoint = exports.isPolygon = exports.isLineString = exports.isPoint = exports.GeometryType = void 0;
|
|
11
|
+
// 导出几何类型
|
|
12
|
+
var geometry_1 = require("./geometry");
|
|
13
|
+
Object.defineProperty(exports, "GeometryType", { enumerable: true, get: function () { return geometry_1.GeometryType; } });
|
|
14
|
+
Object.defineProperty(exports, "isPoint", { enumerable: true, get: function () { return geometry_1.isPoint; } });
|
|
15
|
+
Object.defineProperty(exports, "isLineString", { enumerable: true, get: function () { return geometry_1.isLineString; } });
|
|
16
|
+
Object.defineProperty(exports, "isPolygon", { enumerable: true, get: function () { return geometry_1.isPolygon; } });
|
|
17
|
+
Object.defineProperty(exports, "isMultiPoint", { enumerable: true, get: function () { return geometry_1.isMultiPoint; } });
|
|
18
|
+
Object.defineProperty(exports, "isMultiLineString", { enumerable: true, get: function () { return geometry_1.isMultiLineString; } });
|
|
19
|
+
Object.defineProperty(exports, "isMultiPolygon", { enumerable: true, get: function () { return geometry_1.isMultiPolygon; } });
|
|
20
|
+
Object.defineProperty(exports, "isGeometryCollection", { enumerable: true, get: function () { return geometry_1.isGeometryCollection; } });
|
|
21
|
+
Object.defineProperty(exports, "validateCoordinates", { enumerable: true, get: function () { return geometry_1.validateCoordinates; } });
|
|
22
|
+
Object.defineProperty(exports, "validateFeatureGeometry", { enumerable: true, get: function () { return geometry_1.validateFeatureGeometry; } });
|
|
23
|
+
// 导出要素类型
|
|
24
|
+
var feature_1 = require("./feature");
|
|
25
|
+
Object.defineProperty(exports, "FeatureType", { enumerable: true, get: function () { return feature_1.FeatureType; } });
|
|
26
|
+
Object.defineProperty(exports, "isFeature", { enumerable: true, get: function () { return feature_1.isFeature; } });
|
|
27
|
+
Object.defineProperty(exports, "isFeatureCollection", { enumerable: true, get: function () { return feature_1.isFeatureCollection; } });
|
|
28
|
+
Object.defineProperty(exports, "createFeature", { enumerable: true, get: function () { return feature_1.createFeature; } });
|
|
29
|
+
Object.defineProperty(exports, "createFeatureCollection", { enumerable: true, get: function () { return feature_1.createFeatureCollection; } });
|
|
30
|
+
// 导出坐标参考系统类型
|
|
31
|
+
var crs_1 = require("./crs");
|
|
32
|
+
Object.defineProperty(exports, "CRSType", { enumerable: true, get: function () { return crs_1.CRSType; } });
|
|
33
|
+
Object.defineProperty(exports, "CommonCRS", { enumerable: true, get: function () { return crs_1.CommonCRS; } });
|
|
34
|
+
Object.defineProperty(exports, "isNamedCRS", { enumerable: true, get: function () { return crs_1.isNamedCRS; } });
|
|
35
|
+
Object.defineProperty(exports, "isLinkedCRS", { enumerable: true, get: function () { return crs_1.isLinkedCRS; } });
|
|
36
|
+
Object.defineProperty(exports, "createNamedCRS", { enumerable: true, get: function () { return crs_1.createNamedCRS; } });
|
|
37
|
+
Object.defineProperty(exports, "createLinkedCRS", { enumerable: true, get: function () { return crs_1.createLinkedCRS; } });
|
|
38
|
+
// 导出边界框类型
|
|
39
|
+
var bbox_1 = require("./bbox");
|
|
40
|
+
Object.defineProperty(exports, "is2DBBox", { enumerable: true, get: function () { return bbox_1.is2DBBox; } });
|
|
41
|
+
Object.defineProperty(exports, "is3DBBox", { enumerable: true, get: function () { return bbox_1.is3DBBox; } });
|
|
42
|
+
Object.defineProperty(exports, "createBBox2D", { enumerable: true, get: function () { return bbox_1.createBBox2D; } });
|
|
43
|
+
Object.defineProperty(exports, "createBBox3D", { enumerable: true, get: function () { return bbox_1.createBBox3D; } });
|
|
44
|
+
Object.defineProperty(exports, "bboxToObject", { enumerable: true, get: function () { return bbox_1.bboxToObject; } });
|
|
45
|
+
Object.defineProperty(exports, "objectToBBox", { enumerable: true, get: function () { return bbox_1.objectToBBox; } });
|
|
46
|
+
Object.defineProperty(exports, "unionBBox", { enumerable: true, get: function () { return bbox_1.unionBBox; } });
|
|
47
|
+
Object.defineProperty(exports, "isPositionInBBox", { enumerable: true, get: function () { return bbox_1.isPositionInBBox; } });
|
|
48
|
+
Object.defineProperty(exports, "getBBoxCenter", { enumerable: true, get: function () { return bbox_1.getBBoxCenter; } });
|
|
49
|
+
// 导出扩展类型
|
|
50
|
+
var extensions_1 = require("./extensions");
|
|
51
|
+
Object.defineProperty(exports, "LayerType", { enumerable: true, get: function () { return extensions_1.LayerType; } });
|
|
52
|
+
Object.defineProperty(exports, "SpatialQueryType", { enumerable: true, get: function () { return extensions_1.SpatialQueryType; } });
|
|
53
|
+
Object.defineProperty(exports, "isVectorLayer", { enumerable: true, get: function () { return extensions_1.isVectorLayer; } });
|
|
54
|
+
Object.defineProperty(exports, "isRasterLayer", { enumerable: true, get: function () { return extensions_1.isRasterLayer; } });
|
|
55
|
+
Object.defineProperty(exports, "isTileLayer", { enumerable: true, get: function () { return extensions_1.isTileLayer; } });
|
|
56
|
+
// 导出工具函数
|
|
57
|
+
var utils_1 = require("./utils");
|
|
58
|
+
Object.defineProperty(exports, "degreesToRadians", { enumerable: true, get: function () { return utils_1.degreesToRadians; } });
|
|
59
|
+
Object.defineProperty(exports, "radiansToDegrees", { enumerable: true, get: function () { return utils_1.radiansToDegrees; } });
|
|
60
|
+
Object.defineProperty(exports, "calculateDistance", { enumerable: true, get: function () { return utils_1.calculateDistance; } });
|
|
61
|
+
Object.defineProperty(exports, "calculateBearing", { enumerable: true, get: function () { return utils_1.calculateBearing; } });
|
|
62
|
+
Object.defineProperty(exports, "calculateDestination", { enumerable: true, get: function () { return utils_1.calculateDestination; } });
|
|
63
|
+
Object.defineProperty(exports, "calculateLineLength", { enumerable: true, get: function () { return utils_1.calculateLineLength; } });
|
|
64
|
+
Object.defineProperty(exports, "calculatePolygonArea", { enumerable: true, get: function () { return utils_1.calculatePolygonArea; } });
|
|
65
|
+
Object.defineProperty(exports, "calculateGeometryBBox", { enumerable: true, get: function () { return utils_1.calculateGeometryBBox; } });
|
|
66
|
+
Object.defineProperty(exports, "calculateFeatureCollectionBBox", { enumerable: true, get: function () { return utils_1.calculateFeatureCollectionBBox; } });
|
|
67
|
+
Object.defineProperty(exports, "simplifyLineString", { enumerable: true, get: function () { return utils_1.simplifyLineString; } });
|
|
68
|
+
Object.defineProperty(exports, "createBuffer", { enumerable: true, get: function () { return utils_1.createBuffer; } });
|
|
69
|
+
// 版本信息
|
|
70
|
+
exports.VERSION = '1.0.0';
|
|
71
|
+
// 默认导出
|
|
72
|
+
exports.default = {
|
|
73
|
+
VERSION: exports.VERSION
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* 使用示例:
|
|
77
|
+
*
|
|
78
|
+
* ```typescript
|
|
79
|
+
* import {
|
|
80
|
+
* Point,
|
|
81
|
+
* Feature,
|
|
82
|
+
* FeatureCollection,
|
|
83
|
+
* createFeature,
|
|
84
|
+
* calculateDistance
|
|
85
|
+
* } from 'geo-types-cz';
|
|
86
|
+
*
|
|
87
|
+
* // 创建点几何
|
|
88
|
+
* const point: Point = {
|
|
89
|
+
* type: 'Point',
|
|
90
|
+
* coordinates: [116.3974, 39.9093] // 北京天安门
|
|
91
|
+
* };
|
|
92
|
+
*
|
|
93
|
+
* // 创建要素
|
|
94
|
+
* const feature = createFeature(point, {
|
|
95
|
+
* name: '天安门',
|
|
96
|
+
* city: '北京'
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* // 计算两点间距离
|
|
100
|
+
* const distance = calculateDistance(
|
|
101
|
+
* [116.3974, 39.9093], // 天安门
|
|
102
|
+
* [121.4737, 31.2304] // 上海外滩
|
|
103
|
+
* );
|
|
104
|
+
*
|
|
105
|
+
* console.log(`北京到上海的距离: ${Math.round(distance / 1000)}公里`);
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,SAAS;AACT,uCAqBoB;AAnBlB,wGAAA,YAAY,OAAA;AAUZ,mGAAA,OAAO,OAAA;AACP,wGAAA,YAAY,OAAA;AACZ,qGAAA,SAAS,OAAA;AACT,wGAAA,YAAY,OAAA;AACZ,6GAAA,iBAAiB,OAAA;AACjB,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA;AACpB,+GAAA,mBAAmB,OAAA;AACnB,mHAAA,uBAAuB,OAAA;AAGzB,SAAS;AACT,qCAUmB;AATjB,sGAAA,WAAW,OAAA;AAKX,oGAAA,SAAS,OAAA;AACT,8GAAA,mBAAmB,OAAA;AACnB,wGAAA,aAAa,OAAA;AACb,kHAAA,uBAAuB,OAAA;AAGzB,aAAa;AACb,6BAWe;AAVb,8FAAA,OAAO,OAAA;AAKP,gGAAA,SAAS,OAAA;AACT,iGAAA,UAAU,OAAA;AACV,kGAAA,WAAW,OAAA;AACX,qGAAA,cAAc,OAAA;AACd,sGAAA,eAAe,OAAA;AAGjB,UAAU;AACV,+BAcgB;AATd,gGAAA,QAAQ,OAAA;AACR,gGAAA,QAAQ,OAAA;AACR,oGAAA,YAAY,OAAA;AACZ,oGAAA,YAAY,OAAA;AACZ,oGAAA,YAAY,OAAA;AACZ,oGAAA,YAAY,OAAA;AACZ,iGAAA,SAAS,OAAA;AACT,wGAAA,gBAAgB,OAAA;AAChB,qGAAA,aAAa,OAAA;AAGf,SAAS;AACT,2CAqBsB;AAhBpB,uGAAA,SAAS,OAAA;AAQT,8GAAA,gBAAgB,OAAA;AAIhB,2GAAA,aAAa,OAAA;AACb,2GAAA,aAAa,OAAA;AACb,yGAAA,WAAW,OAAA;AAIb,SAAS;AACT,iCAYiB;AAXf,yGAAA,gBAAgB,OAAA;AAChB,yGAAA,gBAAgB,OAAA;AAChB,0GAAA,iBAAiB,OAAA;AACjB,yGAAA,gBAAgB,OAAA;AAChB,6GAAA,oBAAoB,OAAA;AACpB,4GAAA,mBAAmB,OAAA;AACnB,6GAAA,oBAAoB,OAAA;AACpB,8GAAA,qBAAqB,OAAA;AACrB,uHAAA,8BAA8B,OAAA;AAC9B,2GAAA,kBAAkB,OAAA;AAClB,qGAAA,YAAY,OAAA;AAGd,OAAO;AACM,QAAA,OAAO,GAAG,OAAO,CAAC;AAE/B,OAAO;AACP,kBAAe;IACb,OAAO,EAAP,eAAO;CACR,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GIS工具函数
|
|
3
|
+
* 提供常用的地理计算和操作函数
|
|
4
|
+
*/
|
|
5
|
+
import { Position, Geometry, Point, LineString, Polygon } from './geometry';
|
|
6
|
+
import { FeatureCollection } from './feature';
|
|
7
|
+
import { BBox } from './bbox';
|
|
8
|
+
export declare function degreesToRadians(degrees: number): number;
|
|
9
|
+
export declare function radiansToDegrees(radians: number): number;
|
|
10
|
+
export declare function calculateDistance(pos1: Position, pos2: Position): number;
|
|
11
|
+
export declare function calculateBearing(pos1: Position, pos2: Position): number;
|
|
12
|
+
export declare function calculateDestination(start: Position, distance: number, bearing: number): Position;
|
|
13
|
+
export declare function calculateLineLength(lineString: LineString): number;
|
|
14
|
+
export declare function calculatePolygonArea(polygon: Polygon): number;
|
|
15
|
+
export declare function calculateGeometryBBox(geometry: Geometry): BBox;
|
|
16
|
+
export declare function calculateFeatureCollectionBBox(featureCollection: FeatureCollection): BBox;
|
|
17
|
+
export declare function simplifyLineString(lineString: LineString, tolerance: number): LineString;
|
|
18
|
+
export declare function createBuffer(geometry: Point, distance: number): Polygon;
|
|
19
|
+
//# sourceMappingURL=utils.d.ts.map
|