Appearance
turf
函数
| 函数 | 描述 |
|---|---|
| along | Takes a LineString and returns a Point at a specified distance along the line. |
| angle | Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise) angle with origin on the startPoint-midPoint segment, or its explementary angle if required. |
| area | Calculates the geodesic area in square meters of one or more polygons. |
| bbox | Calculates the bounding box for any GeoJSON object, including FeatureCollection. Uses geojson.bbox if available and options.recompute is not set. |
| bboxClip | Takes a Feature and a bbox and clips the feature to the bbox using lineclip. May result in degenerate edges when clipping Polygons. |
| bboxPolygon | Takes a bbox and returns an equivalent polygon. |
| bearing | Takes two Point|points and finds the geographic bearing between them, i.e. the angle measured in degrees from the north line (0 degrees) |
| bezierSpline | Takes a line and returns a curved version by applying a Bezier spline algorithm. |
| booleanClockwise | Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise. |
| booleanConcave | Takes a polygon and return true or false as to whether it is concave or not. |
| booleanContains | Tests whether geometry a contains geometry b. The interiors of both geometries must intersect, and the interior and boundary of geometry b must not intersect the exterior of geometry a. booleanContains(a, b) is equivalent to booleanWithin(b, a) |
| booleanCrosses | Boolean-Crosses returns True if the intersection results in a geometry whose dimension is one less than the maximum dimension of the two source geometries and the intersection set is interior to both source geometries. |
| booleanDisjoint | Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set. |
| booleanEqual | Determine whether two geometries of the same type have identical X,Y coordinate values. See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm |
| booleanIntersects | Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set. |
| booleanOverlap | Compares two geometries of the same dimension and returns true if their intersection set results in a geometry different from both but of the same dimension. It applies to Polygon/Polygon, LineString/LineString, Multipoint/Multipoint, MultiLineString/MultiLineString and MultiPolygon/MultiPolygon. |
| booleanParallel | Boolean-Parallel returns True if each segment of line1 is parallel to the correspondent segment of line2 |
| booleanPointInPolygon | 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. |
| booleanPointOnLine | Returns true if a point is on a line. Accepts a optional parameter to ignore the start and end vertices of the linestring. |
| booleanTouches | Boolean-touches true if none of the points common to both geometries intersect the interiors of both geometries. |
| booleanValid | booleanValid checks if the geometry is a valid according to the OGC Simple Feature Specification. |
| booleanWithin | Tests whether geometry a is contained by geometry b. The interiors of both geometries must intersect, and the interior and boundary of geometry a must not intersect the exterior of geometry b. booleanWithin(a, b) is equivalent to booleanContains(b, a) |
| buffer | http://turfjs.org/docs/#buffer |
| center | Takes a Feature or FeatureCollection and returns the absolute center point of all features. |
| centerMean | Takes a Feature or FeatureCollection and returns the mean center. Can be weighted. |
| centerMedian | Takes a FeatureCollection of points and calculates the median center, algorithimically. The median center is understood as the point that is requires the least total travel from all other points. |
| centerOfMass | Takes any Feature or a FeatureCollection and returns its center of mass using this formula: Centroid of Polygon. |
| centroid | Computes the centroid as the mean of all vertices within the object. |
| circle | Takes a Point and calculates the circle polygon given a radius in Units; and steps for precision. |
| cleanCoords | Removes redundant coordinates from any GeoJSON Geometry. |
| clone | Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'. ~3-5x faster than the common JSON.parse + JSON.stringify combo method. |
| getCluster | Get Cluster |
| clusterEach | clusterEach |
| clusterReduce | Reduce clusters in GeoJSON Features, similar to Array.reduce() |
| clustersDbscan | Takes a set of points and partition them into clusters according to [https://en.wikipedia.org/wiki/DBSCAN|DBSCAN's](https://en.wikipedia.org/wiki/DBSCAN |
| clustersKmeans | Takes a set of points and partition them into clusters using the k-mean . It uses the k-means algorithm |
| collect | Merges a specified property from a FeatureCollection of points into a FeatureCollection of polygons. Given an inProperty on points and an outProperty for polygons, this finds every point that lies within each polygon, collects the inProperty values from those points, and adds them as an array to outProperty on the polygon. |
| combine | Combines a FeatureCollection of Point, LineString, or Polygon features into MultiPoint, MultiLineString, or MultiPolygon features. |
| concave | Takes a set of points and returns a concave hull Polygon or MultiPolygon. Internally, this uses turf-tin to generate geometries. |
| convex | Takes a Feature or a FeatureCollection and returns a convex hull Polygon. |
| destination | Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the Haversine formula to account for global curvature. |
| difference | Finds the difference between multiple polygons by clipping the subsequent polygon from the first. |
| dissolve | Dissolves a FeatureCollection of Polygon features, filtered by an optional property name:value. Note that MultiPolygon features within the collection are not supported |
| distance | Calculates the distance between two coordinates in degrees, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. |
| distanceWeight | - |
| ellipse | Takes a Point and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision. |
| envelope | Takes any number of features and returns a rectangular Polygon that encompasses all vertices. |
| explode | Takes a feature or set of features and returns all positions as points. |
| flatten | Flattens any GeoJSON to a FeatureCollection inspired by geojson-flatten. |
| flip | Takes input features and flips all of their coordinates from [x, y] to [y, x]. |
| geojsonRbush | GeoJSON implementation of RBush spatial index. |
| greatCircle | Calculate great circles routes as LineString or MultiLineString. If the start and end points span the antimeridian, the resulting feature will be split into a MultiLineString. If the start and end positions are the same then a LineString will be returned with duplicate coordinates the length of the npoints option. |
| feature | Wraps a GeoJSON Geometry in a GeoJSON Feature. |
| geometry | Creates a GeoJSON Geometry from a Geometry string type & coordinates. For GeometryCollection type use helpers.geometryCollection |
| point | Creates a Point Feature from a Position. |
| points | Creates a Point FeatureCollection from an Array of Point coordinates. |
| polygon | Creates a Polygon Feature from an Array of LinearRings. |
| polygons | Creates a Polygon FeatureCollection from an Array of Polygon coordinates. |
| lineString | Creates a LineString Feature from an Array of Positions. |
| lineStrings | Creates a LineString FeatureCollection from an Array of LineString coordinates. |
| featureCollection | Takes one or more Features and creates a FeatureCollection. |
| multiLineString | Creates a Feature<MultiLineString> based on a coordinate array. Properties can be added optionally. |
| multiPoint | Creates a Feature<MultiPoint> based on a coordinate array. Properties can be added optionally. |
| multiPolygon | Creates a Feature<MultiPolygon> based on a coordinate array. Properties can be added optionally. |
| geometryCollection | Creates a Feature<GeometryCollection> based on a coordinate array. Properties can be added optionally. |
| round | Round number to precision |
| radiansToLength | Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit. Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet |
| lengthToRadians | Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet |
| lengthToDegrees | Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet |
| bearingToAzimuth | Converts any bearing angle from the north line direction (positive clockwise) and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line |
| azimuthToBearing | Converts any azimuth angle from the north line direction (positive clockwise) and returns an angle between -180 and +180 degrees (positive clockwise), 0 being the north line |
| radiansToDegrees | Converts an angle in radians to degrees |
| degreesToRadians | Converts an angle in degrees to radians |
| convertLength | Converts a length from one unit to another. |
| convertArea | Converts an area from one unit to another. |
| isNumber | isNumber |
| isObject | isObject |
| hexGrid | Takes a bounding box and the diameter of the cell and returns a FeatureCollection of flat-topped hexagons or triangles (Polygon features) aligned in an "odd-q" vertical grid as described in Hexagonal Grids. |
| interpolate | Takes a set of points and estimates their 'property' values on a grid using the Inverse Distance Weighting (IDW) method. |
| intersect | Takes polygon or multi-polygon geometries and finds their polygonal intersection. If they don't intersect, returns null. |
| getCoord | Unwrap a coordinate from a Point Feature, Geometry or a single coordinate. |
| getCoords | Unwrap coordinates from a Feature, Geometry Object or an Array |
| containsNumber | Checks if coordinates contains a number |
| geojsonType | Enforce expectations about types of GeoJSON objects for Turf. |
| featureOf | Enforce expectations about types of Feature inputs for Turf. Internally this uses geojsonType to judge geometry types. |
| collectionOf | Enforce expectations about types of FeatureCollection inputs for Turf. Internally this uses geojsonType to judge geometry types. |
| getGeom | Get Geometry from Feature or Geometry Object |
| getType | Get GeoJSON object's type, Geometry type is prioritize. |
| isobands | Takes a square or rectangular grid FeatureCollection of Point features with z-values and an array of value breaks and generates filled contour isobands. |
| isolines | Takes a grid FeatureCollection of Point features with z-values and an array of value breaks and generates isolines. |
| kinks | Takes a linestring, multi-linestring, multi-polygon or polygon and returns points at all self-intersections. |
| length | Takes a GeoJSON and measures its length in the specified units, (Multi)Point's distance are ignored. |
| lineArc | Creates a circular arc, of a circle of the given radius and center point, between bearing1 and bearing2; 0 bearing is North of center point, positive clockwise. |
| lineChunk | Divides a LineString into chunks of a specified length. If the line is shorter than the segment length then the original line is returned. |
| lineIntersect | Takes any LineString or Polygon GeoJSON and returns the intersecting point(s). |
| lineOffset | Takes a line and returns a line at offset by the specified distance. |
| lineOverlap | Takes any LineString or Polygon and returns the overlapping lines between both features. |
| lineSegment | Creates a FeatureCollection of 2-vertex LineString segments from a (Multi)LineString or (Multi)Polygon. |
| lineSlice | Takes a line, a start Point, and a stop point and returns a subsection of the line in-between those points. The start & stop points don't need to fall exactly on the line. |
| lineSliceAlong | Takes a line, a specified distance along the line to a start Point, and a specified distance along the line to a stop point and returns a subsection of the line in-between those points. |
| lineSplit | Split a LineString by another GeoJSON Feature. |
| lineToPolygon | Converts (Multi)LineString(s) to Polygon(s). |
| mask | Takes polygons or multipolygons and an optional mask, and returns an exterior ring polygon with holes. |
| coordEach | Iterate over coordinates in any GeoJSON object, similar to Array.forEach() |
| coordReduce | Reduce coordinates in any GeoJSON object, similar to Array.reduce() |
| propEach | Iterate over properties in any GeoJSON object, similar to Array.forEach() |
| propReduce | Reduce properties in any GeoJSON object into a single value, similar to how Array.reduce works. However, in this case we lazily run the reduction, so an array of all properties is unnecessary. |
| featureEach | Iterate over features in any GeoJSON object, similar to Array.forEach. |
| featureReduce | Reduce features in any GeoJSON object, similar to Array.reduce(). |
| coordAll | Get all coordinates from any GeoJSON object. |
| geomEach | Iterate over each geometry in any GeoJSON object, similar to Array.forEach() |
| geomReduce | Reduce geometry in any GeoJSON object, similar to Array.reduce(). |
| flattenEach | Iterate over flattened features in any GeoJSON object, similar to Array.forEach. |
| flattenReduce | Reduce flattened features in any GeoJSON object, similar to Array.reduce(). |
| segmentEach | Iterate over 2-vertex line segment in any GeoJSON object, similar to Array.forEach() (Multi)Point geometries do not contain segments therefore they are ignored during this operation. |
| segmentReduce | Reduce 2-vertex line segment in any GeoJSON object, similar to Array.reduce() (Multi)Point geometries do not contain segments therefore they are ignored during this operation. |
| lineEach | Iterate over line or ring coordinates in LineString, Polygon, MultiLineString, MultiPolygon Features or Geometries, similar to Array.forEach. |
| lineReduce | Reduce features in any GeoJSON object, similar to Array.reduce(). |
| findSegment | Finds a particular 2-vertex LineString Segment from a GeoJSON using @turf/meta indexes. |
| findPoint | Finds a particular Point from a GeoJSON using @turf/meta indexes. |
| midpoint | Takes two points and returns a point midway between them. The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account. |
| moranIndex | Moran's I measures patterns of attribute values associated with features. The method reveal whether similar values tend to occur near each other, or whether high or low values are interspersed. |
| nearestNeighborAnalysis | Nearest Neighbor Analysis calculates an index based on the average distances between points in the dataset, thereby providing inference as to whether the data is clustered, dispersed, or randomly distributed within the study area. |
| nearestPoint | Takes a reference point and a FeatureCollection of Features with Point geometries and returns the point from the FeatureCollection closest to the reference. This calculation is geodesic. |
| nearestPointOnLine | Returns the nearest point on a line to a given point. |
| nearestPointToLine | Returns the closest point, of a collection of points, to a line. The returned point has a dist property indicating its distance to the line. |
| planepoint | Takes a triangular plane as a polygon and a point within that triangle, and returns the z-value at that point. |
| pointGrid | Creates a grid of points |
| pointOnFeature | Takes a Feature or FeatureCollection and returns a Point guaranteed to be on the surface of the feature. |
| pointToLineDistance | Calculates the distance between a given point and the nearest point on a line. Sometimes referred to as the cross track distance. |
| pointToPolygonDistance | Calculates the distance from a point to the edges of a polygon or multi-polygon. Returns negative values for points inside the polygon. Handles polygons with holes and multi-polygons. A hole is treated as the exterior of the polygon. |
| pointsWithinPolygon | Finds Points or MultiPoint coordinate positions that fall within (Multi)Polygon(s). |
| polygonSmooth | Smooths a Polygon or MultiPolygon. Based on Chaikin's algorithm. Warning: may create degenerate polygons. |
| polygonTangents | Finds the tangents of a (Multi)Polygon from a Point. |
| polygonToLine | Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString. |
| polygonize | Polygonizes (Multi)LineString(s) into Polygons. |
| toMercator | Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection |
| toWgs84 | Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection |
| quadratAnalysis | Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts the number of features in each quadrat and creates a frequency table. The table lists the number of quadrats containing no features, the number containing one feature, two features, and so on, all the way up to the quadrat containing the most features. The method then creates the frequency table for the random distribution, usually based on a Poisson distribution. The method uses the distribution to calculate the probability for 0 feature occuring, 1 feature occuring, 2 features, and so on, and lists these probabilities in the frequency table. By comparing the two frequency tables, you can see whether the features create a pattern. If the table for the observed distribution has more quadrats containing many features than the table for the random distribution dose, then the features create a clustered pattern. |
| randomPosition | Returns a random position within a bounding box. |
| randomPoint | Returns a random point. |
| randomPolygon | Returns a random polygon. |
| randomLineString | Returns a random LineString. |
| rectangleGrid | Creates a grid of rectangular polygons with width and height consistent in degrees |
| rewind | Rewind LineString|(Multi)LineString or Polygon|(Multi)Polygon outer ring counterclockwise and inner rings clockwise (Uses [Formula](http://en.wikipedia.org/wiki/Shoelace_formula |
| rhumbBearing | Takes two Point|points and finds the bearing angle between them along a Rhumb line i.e. the angle measured in degrees start the north line (0 degrees) |
| rhumbDestination | Returns the destination Point having travelled the given distance along a Rhumb line from the origin Point with the (varant) given bearing. |
| rhumbDistance | Calculates the distance along a rhumb line between two Point|points in Units |
| sample | Takes a FeatureCollection and returns a FeatureCollection with given number of Feature|features at random. |
| sector | Creates a circular sector of a circle of given radius and center Point, between (clockwise) bearing1 and bearing2; 0 bearing is North of center point, positive clockwise. |
| shortestPath | Returns the shortest path from Point|start to Point|end without colliding with any Feature in obstacles FeatureCollection<Polygon> |
| simplify | Simplifies the geometries in a GeoJSON object. Uses the 2d version of simplify-js. |
| square | Takes a bounding box and calculates the minimum square bounding box that would contain the input. |
| squareGrid | Creates a grid of square polygons with cell length consistent in degrees |
| standardDeviationalEllipse | Takes a collection of features and returns a standard deviational ellipse, also known as a “directional distribution.” The standard deviational ellipse aims to show the direction and the distribution of a dataset by drawing an ellipse that contains about one standard deviation’s worth (~ 70%) of the data. |
| tag | Takes a set of points and a set of polygons and/or multipolygons and performs a spatial join. |
| tesselate | Tesselates a polygon or multipolygon into a collection of triangle polygons using earcut. |
| tin | Takes a set of points and creates a Triangulated Irregular Network, or a TIN for short, returned as a collection of Polygons. These are often used for developing elevation contour maps or stepped heat visualizations. |
| transformRotate | Rotates any geojson Feature or Geometry of a specified angle, around its centroid or a given pivot point. |
| transformScale | Scale GeoJSON objects from a given point by a scaling factor e.g. factor=2 would make each object 200% larger. If a FeatureCollection is provided, the origin point will be calculated based on each individual feature unless an exact |
| transformTranslate | Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line on the provided direction angle. |
| triangleGrid | Creates a grid of triangular polygons. |
| truncate | Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry. |
| union | Takes a collection of input polygons and returns a combined polygon. If the input polygons are not contiguous, this function returns a multi-polygon feature. |
| unkinkPolygon | Takes a kinked polygon and returns a feature collection of polygons that have no kinks. |
| voronoi | Takes a collection of points and a bounding box, and returns a collection of Voronoi polygons. |
变量
| 变量 | 描述 |
|---|---|
| earthRadius | The Earth radius in meters. Used by Turf modules that model the Earth as a sphere. The mean radius was selected because it is recommended by the Haversine formula (used by turf/distance) to reduce error. |
| factors | Unit of measurement factors based on earthRadius. |
| areaFactors | Area of measurement factors based on 1 square meter. |
命名空间
| 命名空间 | 描述 |
|---|---|
| clusters | - |
| helpers | - |
| invariant | - |
| meta | - |
| projection | - |
| random | - |
接口
| 接口 | 描述 |
|---|---|
| NearestNeighborStatistics | Nearest neighbour statistics. |
| NearestNeighborStudyArea | Nearest neighbour study area polygon feature. |
| QuadratAnalysisResult | - |
类型别名
| 类型别名 | 描述 |
|---|---|
| Id | Id |
| Coord | - |
| Units | Linear measurement units. |
| AreaUnits | Area measurement units. |
| Grid | Grid types. |
| Corners | Shorthand corner identifiers. |
| Lines | Geometries made up of lines i.e. lines and polygons. |
| AllGeoJSON | Convenience type for all possible GeoJSON. |
