mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-28 12:43:06 +08:00
Completed the Helper definitions.
This commit is contained in:
@@ -313,6 +313,36 @@ var snapped = turf.pointOnLine(line, point1);
|
||||
// Tests Helper
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -- Test featurecollection --
|
||||
var fc = turf.featurecollection([point1, point2]);
|
||||
|
||||
// -- Test linestring --
|
||||
var linestring1 = turf.linestring([
|
||||
[-21.964416, 64.148203],
|
||||
[-21.956176, 64.141316],
|
||||
[-21.93901, 64.135924],
|
||||
[-21.927337, 64.136673]
|
||||
]);
|
||||
var linestring2 = turf.linestring([
|
||||
[-21.929054, 64.127985],
|
||||
[-21.912918, 64.134726],
|
||||
[-21.916007, 64.141016],
|
||||
[-21.930084, 64.14446]
|
||||
], {name: 'line 1', distance: 145});
|
||||
|
||||
// -- Test point --
|
||||
var pt1 = turf.point([-75.343, 39.984]);
|
||||
var pt2 = turf.point([-75.343, 39.984], {name: 'point 1', distance: 145});
|
||||
|
||||
// -- Test polygon --
|
||||
var polygon = turf.polygon([[
|
||||
[-2.275543, 53.464547],
|
||||
[-2.275543, 53.489271],
|
||||
[-2.215118, 53.489271],
|
||||
[-2.215118, 53.464547],
|
||||
[-2.275543, 53.464547]
|
||||
]], { name: 'poly1', population: 400});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Tests Data
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Vendored
+31
@@ -261,6 +261,37 @@ declare module turf {
|
||||
// Helper
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Takes one or more Features and creates a FeatureCollection.
|
||||
* @param features Input features
|
||||
* @returns A FeatureCollection of input features
|
||||
*/
|
||||
function featurecollection(features: Array<GeoJSON.Feature>): GeoJSON.FeatureCollection;
|
||||
|
||||
/**
|
||||
* Creates a LineString based on a coordinate array. Properties can be added optionally.
|
||||
* @param coordinates An array of Positions
|
||||
* @param [properties] An Object of key-value pairs to add as properties
|
||||
* @returns A LineString feature
|
||||
*/
|
||||
function linestring(coordinates: Array<Array<number>>, properties?: any): GeoJSON.Feature;
|
||||
|
||||
/**
|
||||
* Takes coordinates and properties (optional) and returns a new Point feature.
|
||||
* @param coordinates Longitude, latitude position (each in decimal degrees)
|
||||
* @param [properties] An Object of key-value pairs to add as properties
|
||||
* @returns A Point feature
|
||||
*/
|
||||
function point(coordinates: Array<number>, properties?: any): GeoJSON.Feature;
|
||||
|
||||
/**
|
||||
* Takes an array of LinearRings and optionally an Object with properties and returns a Polygon feature.
|
||||
* @param rings An array of LinearRings
|
||||
* @param [properties] An Object of key-value pairs to add as properties
|
||||
* @returns A Polygon feature
|
||||
*/
|
||||
function polygon(rings: Array<Array<Array<number>>>, properties?: any): GeoJSON.Feature;
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Data
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user