index.d.ts 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. import {
  2. Point,
  3. LineString,
  4. Polygon,
  5. MultiLineString,
  6. MultiPolygon,
  7. FeatureCollection,
  8. Feature,
  9. GeometryObject,
  10. GeometryCollection,
  11. AllGeoJSON,
  12. Properties,
  13. Geometries,
  14. Lines,
  15. BBox,
  16. Id,
  17. } from "@turf/helpers";
  18. /**
  19. * http://turfjs.org/docs/#coordreduce
  20. */
  21. export function coordReduce<Reducer extends any>(
  22. geojson: AllGeoJSON,
  23. callback: (
  24. previousValue: Reducer,
  25. currentCoord: number[],
  26. coordIndex: number,
  27. featureIndex: number,
  28. multiFeatureIndex: number,
  29. geometryIndex: number
  30. ) => Reducer,
  31. initialValue?: Reducer
  32. ): Reducer;
  33. /**
  34. * http://turfjs.org/docs/#coordeach
  35. */
  36. export function coordEach(
  37. geojson: AllGeoJSON,
  38. callback: (
  39. currentCoord: number[],
  40. coordIndex: number,
  41. featureIndex: number,
  42. multiFeatureIndex: number,
  43. geometryIndex: number
  44. ) => void,
  45. excludeWrapCoord?: boolean
  46. ): void;
  47. /**
  48. * http://turfjs.org/docs/#propeach
  49. */
  50. export function propEach<Props extends Properties>(
  51. geojson: Feature<any> | FeatureCollection<any> | Feature<GeometryCollection>,
  52. callback: (currentProperties: Props, featureIndex: number) => void
  53. ): void;
  54. /**
  55. * http://turfjs.org/docs/#propreduce
  56. */
  57. export function propReduce<Reducer extends any, P = Properties>(
  58. geojson:
  59. | Feature<any, P>
  60. | FeatureCollection<any, P>
  61. | Geometries
  62. | GeometryCollection,
  63. callback: (
  64. previousValue: Reducer,
  65. currentProperties: P,
  66. featureIndex: number
  67. ) => Reducer,
  68. initialValue?: Reducer
  69. ): Reducer;
  70. /**
  71. * http://turfjs.org/docs/#featurereduce
  72. */
  73. export function featureReduce<
  74. Reducer extends any,
  75. G extends Geometries,
  76. P = Properties
  77. >(
  78. geojson:
  79. | Feature<G, P>
  80. | FeatureCollection<G, P>
  81. | Feature<GeometryCollection, P>,
  82. callback: (
  83. previousValue: Reducer,
  84. currentFeature: Feature<G, P>,
  85. featureIndex: number
  86. ) => Reducer,
  87. initialValue?: Reducer
  88. ): Reducer;
  89. /**
  90. * http://turfjs.org/docs/#featureeach
  91. */
  92. export function featureEach<G extends any, P = Properties>(
  93. geojson:
  94. | Feature<G, P>
  95. | FeatureCollection<G, P>
  96. | Feature<GeometryCollection, P>,
  97. callback: (currentFeature: Feature<G, P>, featureIndex: number) => void
  98. ): void;
  99. /**
  100. * http://turfjs.org/docs/#coordall
  101. */
  102. export function coordAll(geojson: AllGeoJSON): number[][];
  103. /**
  104. * http://turfjs.org/docs/#geomreduce
  105. */
  106. export function geomReduce<
  107. Reducer extends any,
  108. G extends Geometries,
  109. P = Properties
  110. >(
  111. geojson:
  112. | Feature<G, P>
  113. | FeatureCollection<G, P>
  114. | G
  115. | GeometryCollection
  116. | Feature<GeometryCollection, P>,
  117. callback: (
  118. previousValue: Reducer,
  119. currentGeometry: G,
  120. featureIndex: number,
  121. featureProperties: P,
  122. featureBBox: BBox,
  123. featureId: Id
  124. ) => Reducer,
  125. initialValue?: Reducer
  126. ): Reducer;
  127. /**
  128. * http://turfjs.org/docs/#geomeach
  129. */
  130. export function geomEach<G extends Geometries | null, P = Properties>(
  131. geojson:
  132. | Feature<G, P>
  133. | FeatureCollection<G, P>
  134. | G
  135. | GeometryCollection
  136. | Feature<GeometryCollection, P>,
  137. callback: (
  138. currentGeometry: G,
  139. featureIndex: number,
  140. featureProperties: P,
  141. featureBBox: BBox,
  142. featureId: Id
  143. ) => void
  144. ): void;
  145. /**
  146. * http://turfjs.org/docs/#flattenreduce
  147. */
  148. export function flattenReduce<
  149. Reducer extends any,
  150. G extends Geometries,
  151. P = Properties
  152. >(
  153. geojson:
  154. | Feature<G, P>
  155. | FeatureCollection<G, P>
  156. | G
  157. | GeometryCollection
  158. | Feature<GeometryCollection, P>,
  159. callback: (
  160. previousValue: Reducer,
  161. currentFeature: Feature<G, P>,
  162. featureIndex: number,
  163. multiFeatureIndex: number
  164. ) => Reducer,
  165. initialValue?: Reducer
  166. ): Reducer;
  167. /**
  168. * http://turfjs.org/docs/#flatteneach
  169. */
  170. export function flattenEach<G = Geometries, P = Properties>(
  171. geojson:
  172. | Feature<G, P>
  173. | FeatureCollection<G, P>
  174. | G
  175. | GeometryCollection
  176. | Feature<GeometryCollection, P>,
  177. callback: (
  178. currentFeature: Feature<G, P>,
  179. featureIndex: number,
  180. multiFeatureIndex: number
  181. ) => void
  182. ): void;
  183. /**
  184. * http://turfjs.org/docs/#segmentreduce
  185. */
  186. export function segmentReduce<Reducer extends any, P = Properties>(
  187. geojson:
  188. | FeatureCollection<Lines, P>
  189. | Feature<Lines, P>
  190. | Lines
  191. | Feature<GeometryCollection, P>
  192. | GeometryCollection,
  193. callback: (
  194. previousValue?: Reducer,
  195. currentSegment?: Feature<LineString, P>,
  196. featureIndex?: number,
  197. multiFeatureIndex?: number,
  198. segmentIndex?: number,
  199. geometryIndex?: number
  200. ) => Reducer,
  201. initialValue?: Reducer
  202. ): Reducer;
  203. /**
  204. * http://turfjs.org/docs/#segmenteach
  205. */
  206. export function segmentEach<P = Properties>(
  207. geojson: AllGeoJSON,
  208. callback: (
  209. currentSegment?: Feature<LineString, P>,
  210. featureIndex?: number,
  211. multiFeatureIndex?: number,
  212. segmentIndex?: number,
  213. geometryIndex?: number
  214. ) => void
  215. ): void;
  216. /**
  217. * http://turfjs.org/docs/#linereduce
  218. */
  219. export function lineReduce<Reducer extends any, P = Properties>(
  220. geojson:
  221. | FeatureCollection<Lines, P>
  222. | Feature<Lines, P>
  223. | Lines
  224. | Feature<GeometryCollection, P>
  225. | GeometryCollection,
  226. callback: (
  227. previousValue?: Reducer,
  228. currentLine?: Feature<LineString, P>,
  229. featureIndex?: number,
  230. multiFeatureIndex?: number,
  231. geometryIndex?: number
  232. ) => Reducer,
  233. initialValue?: Reducer
  234. ): Reducer;
  235. /**
  236. * http://turfjs.org/docs/#lineeach
  237. */
  238. export function lineEach<P = Properties>(
  239. geojson:
  240. | FeatureCollection<Lines, P>
  241. | Feature<Lines, P>
  242. | Lines
  243. | Feature<GeometryCollection, P>
  244. | GeometryCollection,
  245. callback: (
  246. currentLine?: Feature<LineString, P>,
  247. featureIndex?: number,
  248. multiFeatureIndex?: number,
  249. geometryIndex?: number
  250. ) => void
  251. ): void;
  252. /**
  253. * http://turfjs.org/docs/#findsegment
  254. */
  255. export function findSegment<
  256. G extends LineString | MultiLineString | Polygon | MultiPolygon,
  257. P = Properties
  258. >(
  259. geojson: Feature<G, P> | FeatureCollection<G, P> | G,
  260. options?: {
  261. featureIndex?: number;
  262. multiFeatureIndex?: number;
  263. geometryIndex?: number;
  264. segmentIndex?: number;
  265. properties?: P;
  266. bbox?: BBox;
  267. id?: Id;
  268. }
  269. ): Feature<LineString, P>;
  270. /**
  271. * http://turfjs.org/docs/#findpoint
  272. */
  273. export function findPoint<G extends GeometryObject, P = Properties>(
  274. geojson: Feature<G, P> | FeatureCollection<G, P> | G,
  275. options?: {
  276. featureIndex?: number;
  277. multiFeatureIndex?: number;
  278. geometryIndex?: number;
  279. coordIndex?: number;
  280. properties?: P;
  281. bbox?: BBox;
  282. id?: Id;
  283. }
  284. ): Feature<Point, P>;