@idm-plugin/geo 2.1.4 → 2.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,94 @@
1
+ import * as turf from '@turf/turf';
2
+ export interface GeoJsonOptions {
3
+ /** 圆的边数,默认64 */
4
+ steps?: number;
5
+ /** 半径单位,默认 'nauticalmiles'。可选:'meters' | 'kilometers' | 'miles' | 'nauticalmiles' */
6
+ units?: turf.Units;
7
+ /** GeoJSON id */
8
+ id?: string;
9
+ /** GeoJSON name */
10
+ name?: string;
11
+ /** GeoJSON request id */
12
+ requestId?: string;
13
+ /** GeoJSON properties */
14
+ properties?: Record<string, any>;
15
+ }
16
+ export declare class GeoJsonHelper {
17
+ /**
18
+ * 基于turf画圆,返回GeoJSON Feature<Polygon>
19
+ * @param lng 圆心经度
20
+ * @param lat 圆心纬度
21
+ * @param radius 半径
22
+ * @param options 步数、单位等选项
23
+ */
24
+ static drawCircle(lng: number, lat: number, radius: number, options?: GeoJsonOptions): turf.Feature<turf.Polygon>;
25
+ /**
26
+ * 基于turf画矩形,返回GeoJSON Feature<Polygon>
27
+ * @param start 对角线起点 [lng, lat]
28
+ * @param end 对角线终点 [lng, lat]
29
+ * @param options 选项
30
+ */
31
+ static drawRect(start: number[], end: number[], options?: GeoJsonOptions): turf.Feature<turf.Polygon>;
32
+ /**
33
+ * 基于turf画线,返回GeoJSON Feature<LineString>
34
+ * 支持2个或以上的点,需要注意跨180度的情况
35
+ * @param coordinates 坐标点数组,每个元素为 [lng, lat],至少2个点
36
+ * @param options
37
+ * @returns
38
+ */
39
+ static drawLine(coordinates: number[][], options?: GeoJsonOptions): turf.Feature<turf.LineString>;
40
+ /**
41
+ * 基于turf画多边形,返回GeoJSON Feature<Polygon>
42
+ * @param coordinates
43
+ * @param options
44
+ * @returns
45
+ */
46
+ static drawPolygon(coordinates: number[][], options?: GeoJsonOptions): turf.Feature<turf.Polygon>;
47
+ /**
48
+ * 基于turf画点,返回GeoJSON Feature<Point>
49
+ * @param lat
50
+ * @param lng
51
+ * @param options
52
+ * @returns
53
+ */
54
+ static drawPoint(lat: number, lng: number, options?: GeoJsonOptions): turf.Feature<turf.Point>;
55
+ /**
56
+ * 解析ORM GeoJSON Feature (圆), 返回FeatureCollection
57
+ * @param feature
58
+ * @param options
59
+ * @returns
60
+ * 如果feature是圆,则返回圆的中心、端点、半径线 和 边线四个Feature
61
+ */
62
+ static parseCircle(feature: turf.Feature<turf.Polygon>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
63
+ /**
64
+ * 解析ORM GeoJSON Feature (矩形), 返回FeatureCollection
65
+ * @param feature
66
+ * @param options
67
+ * @returns
68
+ * 如果feature是矩形,则返回矩形的四个顶点和矩形Feature
69
+ */
70
+ static parseRect(feature: turf.Feature<turf.Polygon>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
71
+ /**
72
+ * 解析ORM GeoJSON Feature (线), 返回FeatureCollection
73
+ * @param feature
74
+ * @param options
75
+ * @returns
76
+ * 如果feature是线,则返回所有坐标点(首为start、尾为end、中间为point_N)以及线Feature
77
+ */
78
+ static parseLine(feature: turf.Feature<turf.LineString>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
79
+ /**
80
+ * 解析ORM GeoJSON Feature (多边形), 返回FeatureCollection
81
+ * @param feature
82
+ * @param options
83
+ * @returns
84
+ * 如果feature是多边形,则返回多边形的顶点和多边形Feature
85
+ */
86
+ static parsePolygon(feature: turf.Feature<turf.Polygon>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
87
+ /**
88
+ * 将KML转换为GeoJSON
89
+ * @param kml
90
+ * @param options
91
+ * @returns
92
+ */
93
+ static convertKML2GeoJSON(kml: string, options?: GeoJsonOptions): turf.FeatureCollection<any>;
94
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idm-plugin/geo",
3
3
  "private": false,
4
- "version": "2.1.4",
4
+ "version": "2.1.6",
5
5
  "description": "idm plugin for geo in browser",
6
6
  "type": "module",
7
7
  "keywords": [