Completed the Misc definitions.

This commit is contained in:
gcroteau
2015-11-24 21:57:25 -05:00
parent bbc2af3a3f
commit bd95f700d1
2 changed files with 53 additions and 1 deletions
+16 -1
View File
@@ -222,7 +222,7 @@ var bearing = turf.bearing(point1, point2);
var centerPt = turf.center(features);
// -- Test centroid --
var centroidPt = turf.centroid(poly);
var centroidPt = turf.centroid(polygon1);
// -- Test destination --
var distance = 50;
@@ -291,6 +291,21 @@ var union = turf.union(polygon1, polygon2);
// Tests Misc
//////////////////////////////////////////////////////////////////////////
// -- Test combine --
var combined = turf.combine(features);
// -- Test explode --
var points = turf.explode(polygon1);
// -- Test flip --
var flipedPoint = turf.flip(point1);
// -- Test kinks --
var kinks = turf.kinks(polygon1);
// -- Test lineSlice --
var sliced = turf.lineSlice(point1, point2, line);
// -- Test pointOnLine --
var snapped = turf.pointOnLine(line, point1);
+37
View File
@@ -212,6 +212,43 @@ declare module turf {
// Misc
//////////////////////////////////////////////////////
/**
* Combines a FeatureCollection of Point, LineString, or Polygon features into MultiPoint, MultiLineString, or MultiPolygon features.
* @param fc A FeatureCollection of any type
* @returns A FeatureCollection of corresponding type to input
*/
function combine(fc: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection;
/**
* Takes a feature or set of features and returns all positions as points.
* @param input Input features
* @returns Points representing the exploded input features
*/
function explode(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.FeatureCollection;
/**
* Takes input features and flips all of their coordinates from [x, y] to [y, x].
* @param input Input features
* @returns A feature or set of features of the same type as input with flipped coordinates
*/
function flip(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature | GeoJSON.FeatureCollection;
/**
* Takes a polygon and returns points at all self-intersections.
* @param polygon Input polygon
* @returns Self-intersections
*/
function kinks(polygon: GeoJSON.Feature): GeoJSON.FeatureCollection;
/**
* Takes a line, a start Point, and a stop point and returns the line in between those points.
* @param point1 Starting point
* @param point2 Stopping point
* @param line Line to slice
* @returns Sliced line
*/
function lineSlice(point1: GeoJSON.Feature, point2: GeoJSON.Feature, line: GeoJSON.Feature): GeoJSON.Feature;
/**
* Takes a Point and a LineString and calculates the closest Point on the LineString.
* @param line Line to snap to