@idm-plugin/geo 2.1.4 → 2.1.5

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,80 @@
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
+ * 需要注意跨180度的情况
35
+ * @param start
36
+ * @param end
37
+ * @param options
38
+ * @returns
39
+ */
40
+ static drawLine(start: number[], end: number[], options?: GeoJsonOptions): turf.Feature<turf.LineString>;
41
+ /**
42
+ * 基于turf画多边形,返回GeoJSON Feature<Polygon>
43
+ * @param coordinates
44
+ * @param options
45
+ * @returns
46
+ */
47
+ static drawPolygon(coordinates: number[][], options?: GeoJsonOptions): turf.Feature<turf.Polygon>;
48
+ /**
49
+ * 解析ORM GeoJSON Feature (圆), 返回FeatureCollection
50
+ * @param feature
51
+ * @param options
52
+ * @returns
53
+ * 如果feature是圆,则返回圆的中心、端点、半径线 和 边线四个Feature
54
+ */
55
+ static parseCircle(feature: turf.Feature<turf.Polygon>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
56
+ /**
57
+ * 解析ORM GeoJSON Feature (矩形), 返回FeatureCollection
58
+ * @param feature
59
+ * @param options
60
+ * @returns
61
+ * 如果feature是矩形,则返回矩形的四个顶点和矩形Feature
62
+ */
63
+ static parseRect(feature: turf.Feature<turf.Polygon>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
64
+ /**
65
+ * 解析ORM GeoJSON Feature (线), 返回FeatureCollection
66
+ * @param feature
67
+ * @param options
68
+ * @returns
69
+ * 如果feature是线,则返回线的起点和终点以及线Feature
70
+ */
71
+ static parseLine(feature: turf.Feature<turf.LineString>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
72
+ /**
73
+ * 解析ORM GeoJSON Feature (多边形), 返回FeatureCollection
74
+ * @param feature
75
+ * @param options
76
+ * @returns
77
+ * 如果feature是多边形,则返回多边形的顶点和多边形Feature
78
+ */
79
+ static parsePolygon(feature: turf.Feature<turf.Polygon>, options?: GeoJsonOptions): turf.FeatureCollection<any>;
80
+ }
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.5",
5
5
  "description": "idm plugin for geo in browser",
6
6
  "type": "module",
7
7
  "keywords": [