index.d.cts 7.0 KB

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