index.ts
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* @hm/clean-core —— 出险数据清洗算法内核(可移植纯算法包)。
*
* 这个包不含任何 DOM / fetch / 全局状态 / 第三方依赖,因此同一个包既能跑在浏览器 Worker 里
* (实时导入解析),也能跑在 Node CLI 里(离线批量清洗)。宿主(heatmap app)与 B 阶段的
* `clean-adapters` / `clean-cli` 都从这里取算法。
*
* 包分层:
* - geo/* : 坐标系互转、多边形几何、落水判定、海上合法走廊(全是纯函数)
* - cleanRules : 8 类处置规则的核心判据(FLAG 位掩码 + 各 classify/mark*)
* - cleanRows : 编排入口(CleanRow[] → flags + classes + warnings),可移植套件的高层 API
* - dims : 道路名解析(roadOfAddress / buildRoadIndex)
* - types : 数据契约子集(CleanClassKey / CleanSample / CleanClass / UNRESOLVED_LABEL)
*/
/* 数据契约子集 */
export { UNRESOLVED_LABEL } from './types';
export type { CleanClassKey, CleanSample, CleanClass } from './types';
/* 坐标系互转 */
export { gcj02ToWgs84, wgs84ToGcj02, outOfChina } from './geo/coord';
/* 多边形几何 */
export {
pointInRing,
pointInPolygon,
pointInPolygons,
metersPerDegLng,
distanceToBoundaryM,
boundsOf,
} from './geo/polygon';
export type { LngLat, ShapePolygon, NamedPolys, ShapeBounds } from './geo/polygon';
/* 落水 / 域外几何 */
export {
offshoreVerdict,
parseDistrictGeometry,
parseGeoFeatures,
parseGeometryPolys,
} from './geo/offshoreVerdict';
export type { CorridorMatch } from './geo/corridors';
/* 海上合法走廊 */
export { parseCorridors, pointInLegalCorridor } from './geo/corridors';
export type { CorridorFeature } from './geo/corridors';
/* 道路解析 */
export { ROAD_UNRESOLVED, roadOfAddress, buildRoadIndex } from './dims';
/* 规则内核 */
export {
FLAG,
ISO_RADII,
ISO_FLAGS,
SPARSE_DEFAULT_THRESHOLD,
SPARSE_STREET_DEFAULT_THRESHOLD,
SPARSE_STREET_MIN,
SPARSE_STREET_MAX,
isStreetUnresolved,
streetNameOf,
SMALL_DEFAULT_RADIUS_M,
SMALL_DEFAULT_THRESHOLD,
SMALL_RADIUS_MAX,
SMALL_THRESHOLD_MAX,
OFFSHORE_FAR_DIST_M,
flagOfMissing,
missingDimLabels,
presentDimLabels,
classifyRegion,
classifyOffshore,
markIsolated,
markSparseRoads,
markSparseStreets,
markSmallClusters,
CLASS_DEFAULTS,
CLASS_INFO,
} from './cleanRules';
export type {
RegionVerdict,
SparseRoadInput,
SparseRoadResult,
SparseStreetInput,
SparseStreetResult,
SmallClusterInput,
SmallClusterResult,
} from './cleanRules';
/* 编排入口 */
export { cleanRows, loadLandMask, loadCorridors } from './cleanRows';
export type {
CleanRow,
CleanContext,
CleanThresholds,
CleanResult,
} from './cleanRows';