Added Joins definitions to turf.d.ts.

This commit is contained in:
gcroteau
2015-11-25 19:56:27 -05:00
parent ab3aa41ff7
commit 1c55a61177
2 changed files with 35 additions and 0 deletions
+9
View File
@@ -421,6 +421,15 @@ var triangleGrid = turf.triangleGrid(extent, cellWidth, units);
// Tests Joins
//////////////////////////////////////////////////////////////////////////
// -- Test inside --
var isInside1 = turf.inside(point1, polygon);
// -- Test tag --
var tagged = turf.tag(points, triangleGrid, 'fill', 'marker-color');
// -- Test within --
var ptsWithin = turf.within(points, polygons);
//////////////////////////////////////////////////////////////////////////
// Tests Classification
//////////////////////////////////////////////////////////////////////////
+26
View File
@@ -406,6 +406,32 @@ declare module turf {
// Joins
//////////////////////////////////////////////////////
/**
* Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.
* @param point Input point
* @param polygon Input polygon or multipolygon
* @returns true if the Point is inside the Polygon; false if the Point is not inside the Polygon
*/
function inside(point: GeoJSON.Feature, polygon: GeoJSON.Feature): boolean;
/**
* Takes a set of points and a set of polygons and performs a spatial join.
* @param points Input points
* @param polygons Input polygons
* @param polyId Property in polygons to add to joined Point features
* @param containingPolyId Property in points in which to store joined property from polygons
* @returns Points with containingPolyId property containing values from polyId
*/
function tag(points: GeoJSON.FeatureCollection, polygons: GeoJSON.FeatureCollection, polyId: string, containingPolyId: string): GeoJSON.FeatureCollection;
/**
* Takes a set of points and a set of polygons and returns the points that fall within the polygons.
* @param points Input points
* @param polygons Input polygons
* @returns Points that land within at least one polygon
*/
function within(points: GeoJSON.FeatureCollection, polygons: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection;
//////////////////////////////////////////////////////
// Classification
//////////////////////////////////////////////////////