1
- /// <reference path="../ geojson/index.d.ts "/>
1
+ /// <reference types=" geojson"/>
2
2
3
3
declare namespace turf {
4
4
type Units = "miles" | "nauticalmiles" | "degrees" | "radians" | "inches" | "yards" | "meters" | "metres" | "kilometers" | "kilometres" ;
@@ -204,6 +204,124 @@ declare namespace turf {
204
204
*/
205
205
export function nearest ( target : GeoJSON . Feature < GeoJSON . Point > , points : GeoJSON . FeatureCollection < GeoJSON . Point > ) : GeoJSON . Feature < GeoJSON . Point > ;
206
206
207
+ /**
208
+ * Takes a triangular plane as a Polygon and a Point within that trangle and
209
+ * returns the z-value at that point. The Polygon needs to have properties
210
+ * `a`, `b` and `c` that define the values at its three corners.
211
+ */
212
+ export function planepoint ( point : GeoJSON . Feature < GeoJSON . Point > , triangle : GeoJSON . Feature < GeoJSON . Polygon > ) : number ;
213
+
214
+ /**
215
+ * Takes a bounding box and a cell depth and returns a set of Points in a
216
+ * grid.
217
+ */
218
+ export function pointGrid ( bbox : BoundingBox , cellSize : number , units ?: Units ) : GeoJSON . FeatureCollection < GeoJSON . Point > ;
219
+
220
+ /**
221
+ * Takes a Point and a LineString and calculates the closest Point on the
222
+ * LineString.
223
+ */
224
+ export function pointOnLine ( line : GeoJSON . Feature < GeoJSON . LineString > , point : GeoJSON . Feature < GeoJSON . Point > , units ?: Units ) : GeoJSON . Feature < GeoJSON . Point > ;
225
+
226
+ /**
227
+ * Takes a feature and returns a Point guaranteed to be on the surface
228
+ * of the feature.
229
+ *
230
+ * * Given a Polygon, the point will be in the area of the polygon.
231
+ * * Given a LineString, the point will be along the string.
232
+ * * Given a Point, the point will the same as the input.
233
+ */
234
+ export function pointOnSurface ( input : GeoJSON . Feature < GeoJSON . Polygon | GeoJSON . LineString | GeoJSON . Point > | GeoJSON . FeatureCollection < GeoJSON . Polygon | GeoJSON . LineString | GeoJSON . Point > ) : GeoJSON . Feature < GeoJSON . Point > ;
235
+
236
+ interface RandomPointOptions {
237
+ bbox ?: BoundingBox ;
238
+ }
239
+
240
+ interface RandomPolygonOptions {
241
+ num_vertices ?: number ;
242
+ max_radial_length ?: number ;
243
+ bbox ?: BoundingBox ;
244
+ }
245
+
246
+ /**
247
+ * Generates random GeoJSON Points.
248
+ */
249
+ export function random ( type : "point" | "points" , count ?: number , options ?: RandomPointOptions ) : GeoJSON . FeatureCollection < GeoJSON . Point > ;
250
+
251
+ /**
252
+ * Generates random GeoJSON Polygons.
253
+ */
254
+ export function random ( type : "polygon" | "polygons" , count ?: number , options ?: RandomPolygonOptions ) : GeoJSON . FeatureCollection < GeoJSON . Polygon > ;
255
+
256
+ /**
257
+ * Takes a FeatureCollection and returns a FeatureCollection with given
258
+ * number of Features at random.
259
+ */
260
+ export function sample < T extends GeoJSON . GeometryObject | GeoJSON . GeometryCollection > ( input : GeoJSON . FeatureCollection < T > , number : number ) : GeoJSON . FeatureCollection < T > ;
261
+
262
+ type SimplifiableGeometry = GeoJSON . LineString | GeoJSON . Polygon | GeoJSON . MultiLineString | GeoJSON . MultiPolygon ;
263
+
264
+ /**
265
+ * Takes a LineString or Polygon and returns a simplified version.
266
+ * Internally uses simplify-js to perform simplification.
267
+ */
268
+ export function simplify < T extends GeoJSON . Feature < SimplifiableGeometry > | GeoJSON . FeatureCollection < SimplifiableGeometry > | GeoJSON . GeometryCollection > ( feature : T , tolerance : number , highQuality : boolean ) : T ;
269
+
270
+ /**
271
+ * Takes a bounding box and calculates the minimum square bounding box that
272
+ * would contain the input.
273
+ */
274
+ export function square ( bbox : BoundingBox ) : BoundingBox ;
275
+
276
+ /**
277
+ * Takes a bounding box, a cell depth and returns a set of square Polygons
278
+ * in a grid.
279
+ */
280
+ export function squareGrid ( bbox : BoundingBox , cellSize : number , units ?: Units ) : GeoJSON . FeatureCollection < GeoJSON . Polygon > ;
281
+
282
+ /**
283
+ * Takes a set of Points, a set of Polygons and a performs a spatial join.
284
+ */
285
+ export function tag ( points : GeoJSON . FeatureCollection < GeoJSON . Point > , polygons : GeoJSON . FeatureCollection < GeoJSON . Polygon > , inField : string , outField : string ) : GeoJSON . FeatureCollection < GeoJSON . Point > ;
286
+
287
+ /**
288
+ * Tesselates a Feature<Polygon> into a FeatureCollection<Polygon> of
289
+ * triangles using earcut.
290
+ */
291
+ export function tesselate ( polygon : GeoJSON . Feature < GeoJSON . Polygon > ) : GeoJSON . FeatureCollection < GeoJSON . Polygon > ;
292
+
293
+ /**
294
+ * Takes a set of Points, the name of a z-value property and creates a
295
+ * Triangulated Irregular Network (or TIN for short), returned as a
296
+ * collection of Polygons. These are often used for developing elevation
297
+ * contour maps or stepped heat visualizations.
298
+ *
299
+ * This triangulates the points, and adds properties called `a`, `b`, and
300
+ * `c` representing the value of the given `propertyName` at each of the
301
+ * points that represent the corners of the triangle.
302
+ */
303
+ export function tin ( points : GeoJSON . FeatureCollection < GeoJSON . Point > , zProperty ?: string ) : GeoJSON . FeatureCollection < GeoJSON . Polygon > ;
304
+
305
+ /**
306
+ * Takes a bounding box, a cell depth and returns a set of triangular
307
+ * Polygons in a grid.
308
+ */
309
+ export function triangleGrid ( bbox : BoundingBox , cellSize : number , units ?: Units ) : GeoJSON . FeatureCollection < GeoJSON . Polygon > ;
310
+
311
+
312
+ /**
313
+ * Takes two or more Polygons and returns a combined Polygon. If the input
314
+ * Polygons are not contiguous, this function returns a MultiPolygon
315
+ * Feature.
316
+ */
317
+ export function union ( ...polygons : GeoJSON . Feature < GeoJSON . Polygon > [ ] ) : GeoJSON . Feature < GeoJSON . Polygon | GeoJSON . MultiPolygon > ;
318
+
319
+ /**
320
+ * Takes a set of Pionts, a set of Polygons and returns the Points that fall
321
+ * within the Polygons.
322
+ */
323
+ export function within ( points : GeoJSON . FeatureCollection < GeoJSON . Point > , polygons : GeoJSON . FeatureCollection < GeoJSON . Polygon > ) : GeoJSON . FeatureCollection < GeoJSON . Point > ;
324
+
207
325
export import feature = helpers . feature ;
208
326
export import point = helpers . point ;
209
327
export import polygon = helpers . polygon ;
@@ -334,7 +452,8 @@ declare namespace meta {
334
452
export function featureEach ( object : any , callback : ( feature : GeoJSON . Feature < any > ) => void ) : void ;
335
453
336
454
/**
337
- * Get all coordinates from any GeoJSNO object, returning an array of coordinate arrays.
455
+ * Get all coordinates from any GeoJSNO object, returning an array of
456
+ * coordinate arrays.
338
457
*/
339
458
export function coordAll ( object : any ) : GeoJSON . Position [ ] ;
340
459
}
@@ -481,4 +600,60 @@ declare module "@turf/midpoint" {
481
600
482
601
declare module "@turf/nearest" {
483
602
export default turf . nearest ;
603
+ }
604
+
605
+ declare module "@turf/planepoint" {
606
+ export default turf . planepoint ;
607
+ }
608
+
609
+ declare module "@turf/point-grid" {
610
+ export default turf . pointGrid ;
611
+ }
612
+
613
+ declare module "@turf/point-on-line" {
614
+ export default turf . pointOnLine ;
615
+ }
616
+
617
+ declare module "@turf/point-on-surface" {
618
+ export default turf . pointOnSurface ;
619
+ }
620
+
621
+ declare module "@turf/random" {
622
+ export default turf . random ;
623
+ }
624
+
625
+ declare module "@turf/sample" {
626
+ export default turf . sample ;
627
+ }
628
+
629
+ declare module "@turf/simplify" {
630
+ export default turf . simplify ;
631
+ }
632
+
633
+ declare module "@turf/square" {
634
+ export default turf . square ;
635
+ }
636
+
637
+ declare module "@turf/square-grid" {
638
+ export default turf . squareGrid ;
639
+ }
640
+
641
+ declare module "@turf/tag" {
642
+ export default turf . tag ;
643
+ }
644
+
645
+ declare module "@turf/tesselate" {
646
+ export default turf . tesselate ;
647
+ }
648
+
649
+ declare module "@turf/triangle-grid" {
650
+ export default turf . triangleGrid ;
651
+ }
652
+
653
+ declare module "@turf/union" {
654
+ export default turf . union ;
655
+ }
656
+
657
+ declare module "@turf/within" {
658
+ export default turf . within ;
484
659
}
0 commit comments