Changelog History
Page 3
-
v4.6.0 Changes
๐ New Modules
- ๐ฆ
@turf/clean-coords
Removes redundant coordinates from any GeoJSON Geometry. (PR https://github.com/Turfjs/turf/pull/875 - Author @stebogit) @turf/interpolate
Takes a set of points and estimates their 'property' values on a grid using the Inverse Distance Weighting (IDW) method.. (PR https://github.com/Turfjs/turf/pull/832 - Author @stebogit)- ๐ฆ
@turf/clusters-dbscan
Takes a set of Points and partition them into clusters according to DBSCAN's data clustering algorithm. (PR https://github.com/Turfjs/turf/pull/812 and https://github.com/Turfjs/turf/pull/851 - Author @DenisCarriere) > special mention to this incredibly instructive and fun interactive map by @DenisCarriere ๐๐ - ๐ฆ
@turf/clusters
ProvidesgetCluster
,clusterEach
, andclusterReduce
functions. (PR https://github.com/Turfjs/turf/pull/847 - Author @DenisCarriere) - ๐ฆ
@turf/boolean-point-on-line
Returns true if a point is on a line. Accepts a optional parameter to ignore the start and end vertices of the linestring. (PR https://github.com/Turfjs/turf/pull/858 - Author @rowanwins) - ๐ฆ
@turf/boolean-overlap
Takes two features and returns true or false whether or not they overlap, i.e. whether any pair of edges on the two polygons intersect. If there are any edge intersections, the polygons overlap. (PR https://github.com/Turfjs/turf/pull/856 and https://github.com/Turfjs/turf/pull/868 - Author @stebogit @tcql) - ๐ฆ
@turf/boolean-equal
Determine whether two geometries of the same type have identical X,Y coordinate values. (PR https://github.com/Turfjs/turf/pull/869 - Author @stebogit @tcql)
๐ New Features/Enhancements
- ๐ฆ Sets
centered
param default totrue
in@turf/point-grid
(PR https://github.com/Turfjs/turf/pull/836 - Contributor @stebogit) - โ Adds
MultiLineString
support for@turf/point-on-line
(PR https://github.com/Turfjs/turf/pull/838 - Contributor @stebogit) - ๐ Renames
@turf/clusters
=>@turf/clusters-kmeans
, plus adds deprecated warning message to@turf/[email protected]
๐ (See Issue https://github.com/Turfjs/turf/issues/845) - ๐ Changes output type of
@turf/clusters-kmeans
๐ (See Issue https://github.com/Turfjs/turf/issues/850 - Contributor @DenisCarriere) - โ Adds
segmentEach
andsegmentReduce
functions to@turf/meta
๐ (See Issue https://github.com/Turfjs/turf/issues/850 - Contributor @DenisCarriere) - โ Adds tests and linting on JSDoc in TurfJS core from
turf-www
; see Issue https://github.com/Turfjs/turf/issues/859 (PR https://github.com/Turfjs/turf/issues/857 + https://github.com/Turfjs/turf/issues/864 + https://github.com/Turfjs/turf/issues/870 - Contributor @DenisCarriere @stebogit) - ๐ Introduces
null
Geometry support across TurfJS modules (See Issue https://github.com/Turfjs/turf/issues/853) (PR https://github.com/Turfjs/turf/issues/866 - Contributor @DenisCarriere) - Includes feature(Sub)Index in
coordEach
/coordReduce
(@turf/meta) ๐ (PR https://github.com/Turfjs/turf/issues/872 - Contributor @DenisCarriere) - โ Adds
bbox
andid
params plusgeometry
method to@turf/helpers
(PR https://github.com/Turfjs/turf/issues/877 - Contributor @DenisCarriere)
๐ ๐ Bug Fixes
- ๐ฆ Applies
@turf/truncate
to@turf/line-split
๐splitter
input to avoid approximation errors. Fixed #852 (PR https://github.com/Turfjs/turf/pull/855) - ๐ Fixes
@turf-mask
error (See Issue https://github.com/Turfjs/turf/issues/837) (PR https://github.com/Turfjs/turf/pull/865 - Contributor @thiagoxvo) - ๐ Fixes
create-new-module
script error onLICENSE
file creation (See Issue https://github.com/Turfjs/turf/issues/861) (commit df6986e) - ๐ Fixes
@turf/isobands
error oncommonProperties
(See Issue https://github.com/Turfjs/turf/issues/831) (commit 1663f07)
- ๐ฆ
-
v4.5.0 Changes
๐ New Modules
๐ฆ
@turf/clusters
Takes a set of points and partition them into clusters using the k-means clustering algorithm. (PR https://github.com/Turfjs/turf/pull/787 - Author @stebogit )๐ฆ
@turf/boolean-disjoint
Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set. (PR https://github.com/Turfjs/turf/pull/805 - Author @rowanwins)๐ฆ
@turf/boolean-contains
Boolean-contains returns True if the second geometry is completely contained by the first geometry. The interiors of both geometries must intersect and, the interior and boundary of the secondary (geometry b) must not intersect the exterior of the primary (geometry a). Boolean-contains returns the exact opposite result of the@turf/boolean-within
. (PR https://github.com/Turfjs/turf/pull/797 - Author @rowanwins)๐ฆ
@turf/boolean-crosses
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. Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestring, linestring/linestring, linestring/polygon, and linestring/multipolygon comparisons. (PR https://github.com/Turfjs/turf/pull/796 - Author @rowanwins)๐ฆ
@turf/boolean-clockwise
Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise. (PR https://github.com/Turfjs/turf/pull/789 - Authors @morganherlocker @stebogit)๐ฆ
@turf/clone
Prevents GeoJSON coordinates from being mutated, similar toJSON.parse(JSON.stringify(geojson))
. ๐ Only cloning the coordinates can be 3x-20x faster than the parse + stringify approach. (PR https://github.com/Turfjs/turf/pull/824 - Author @DenisCarriere)
๐ New Features/Enhancements
- ๐ฆ
convertArea
Converts a area to the requested unit. (PR https://github.com/Turfjs/turf/pull/821 - Author @wnordmann) - โ Adds mask option to
@turf/point-grid
(PR https://github.com/Turfjs/turf/pull/791) - ๐ New @turf/isolines based on MarchingSquares.js (PR https://github.com/Turfjs/turf/pull/781)
- ๐ Use ES6 modules / Add module.js to @turf/turf (PR https://github.com/Turfjs/turf/pull/793)
- Create-new-module script (PR https://github.com/Turfjs/turf/pull/823)
๐ ๐ Bug Fixes
- Buffer - Drop circle buffer operation (PR https://github.com/Turfjs/turf/pull/786)
- ๐ Fixes
@turf/idw
bad property name #774 (PR https://github.com/Turfjs/turf/pull/800) - ๐ Fix for @turf/polygon-tangents - Resolves #785 (PR https://github.com/Turfjs/turf/pull/792)
-
v4.4.0 Changes
๐ New Modules
- ๐ฆ
@turf/line-offset
โ Adds a new lineOffset module as per this issue. Basically takes an input line and returns a new line offset by the distance. (PR https://github.com/Turfjs/turf/pull/729 - Author @rowanwins) - ๐ฆ
@turf/polygonize
Polygonizes (Multi)LineString(s) into Polygons. Implementation of GEOSPolygonize function (geos::operation::polygonize::Polygonizer). (PR https://github.com/Turfjs/turf/pull/767 - Author @NickCis) - ๐ฆ
@turf/transform-rotate
Rotates any geojson Feature or Geometry of a specified angle, around its centroid or a given pivot point; all rotations follow the right-hand rule. (Issue https://github.com/Turfjs/turf/issues/747 - Author @stebogit) - ๐ฆ
@turf/transform-translate
๐ Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line on the provided direction angle. (Issue https://github.com/Turfjs/turf/issues/747 - Author @stebogit) - ๐ฆ
@turf/transform-scale
Scale a GeoJSON from a given point by a factor of scaling (ex: factor=2 would make the GeoJSON 200% larger). If a FeatureCollection is provided, the origin point will be calculated based on each individual Feature. (Issue https://github.com/Turfjs/turf/issues/747 - Author @stebogit)
๐ New Features
- ๐ Support z-coordinate as input for
@turf/turf-tin
(PR https://github.com/Turfjs/turf/pull/772) - โ Adds properties parameter to
@turf/centroid
and@turf/center
(PR https://github.com/Turfjs/turf/pull/769) - ๐ Include Yarn.lock for all modules & Lerna uses Yarn (Issue https://github.com/Turfjs/turf/issues/704, https://github.com/Turfjs/turf/issues/765, PR https://github.com/Turfjs/turf/pull/766)
- ๐ Use
Tap
at root which enables code coverage reports (Issue https://github.com/Turfjs/turf/issues/328 & PR https://github.com/Turfjs/turf/pull/762) - ๐ Support z-coordinate as input for
@turf/pointplane
(PR https://github.com/Turfjs/turf/pull/754) - โ Add core tests - file management & package.json rules (PR https://github.com/Turfjs/turf/pull/749 & https://github.com/Turfjs/turf/pull/756)
๐ ๐ Bug Fixes
- Website http://turfjs.org is back up and running (Issue https://github.com/Turfjs/turf/issues/777)
- ๐ฆ
@turf/rhumb-destination
issue at 180th meridian (Issue https://github.com/Turfjs/turf/issues/770 & PR https://github.com/Turfjs/turf/pull/771) - Getting too large numbers for Longitude (Issue https://github.com/Turfjs/turf/issues/758 & PR https://github.com/Turfjs/turf/pull/763)
- Throw error if FeatureCollection not array #751 (PR https://github.com/Turfjs/turf/pull/760)
- ๐ Change default param coordinates to 3 @turf/truncate (PR https://github.com/Turfjs/turf/pull/757)
- ๐ฆ along returns a point that is not found by
@turf/point-on-line
(Issue https://github.com/Turfjs/turf/issues/691) - ๐ Fix location of intersect point for
@turf/point-on-line
. (PR https://github.com/Turfjs/turf/pull/750) - ๐ฆ Handle empty geometries as undefined
@turf/buffer
(PR https://github.com/Turfjs/turf/pull/746)
- ๐ฆ
-
v4.3.0 Changes
๐ New Modules
- Rhumb Line Modules (https://github.com/Turfjs/turf/pull/728)
- ๐ฆ
@turf/polygon-tangents
Finds the tangents of a (Multi)Polygon from a Point. (https://github.com/Turfjs/turf/pull/708) - ๐ฆ
@turf/rewind
Rewind LineString or Polygon outer ring ~clockwise~ counter-clockwise and inner rings ~counterclockwise~ clockwise (https://github.com/Turfjs/turf/pull/700 & https://github.com/Turfjs/turf/issues/66) - ๐ฆ
@turf/isobands
- Takes a grid FeatureCollection of Point features with z-values and an array of value breaks and generates filled contour isobands. (https://github.com/Turfjs/turf/pull/619)
๐ New Features
- ๐ New function convertDistance to
@turf/helpers
(https://github.com/Turfjs/turf/pull/732) - โ Add ignoreBoundary param
@turf/inside
(https://github.com/Turfjs/turf/pull/706) - โ Add flattenEach/flattenReduce to
@turf/meta
. (https://github.com/Turfjs/turf/pull/712 & https://github.com/Turfjs/turf/issues/692) - ๐ New Feature
getGeom
&getGeomType
in@turf/invariant
(https://github.com/Turfjs/turf/pull/720) - โ Adds
round()
,radians2degrees()
anddegrees2radians()
toturf-helpers
(https://github.com/Turfjs/turf/pull/715) - โญ๏ธ New Add FeatureCollection & GeometryCollection support to
@turf/rewind
(https://github.com/Turfjs/turf/pull/741)
๐ ๐ Bug Fixes
- ๐ Fix
@turf/circle
translate properties (https://github.com/Turfjs/turf/pull/717) - ๐ฆ Apply equidistance
@turf/buffer
to polygons (https://github.com/Turfjs/turf/issues/660 & https://github.com/Turfjs/turf/pull/718) - ๐ Fix jsts empty (Multi)Polygon error
@turf/difference
(https://github.com/Turfjs/turf/pull/725) - ๐ Support Geometry Objects & Collection (https://github.com/Turfjs/turf/issues/710)
- ๐ New Reverse winding - Polygon CCW & Polygon CW
@turf/rewind
(https://github.com/Turfjs/turf/pull/741) - โญ๏ธ New Fix Feature GeometryCollection to
@turf/buffer
(https://github.com/Turfjs/turf/pull/739) - โญ๏ธ New Re-enable negative
radius
to@turf/buffer
(https://github.com/Turfjs/turf/pull/736)
-
v4.2.0 Changes
๐ New Modules
โจ Enhancements
- Add mutate param to
@turf/flip
- ๐ Add Geometry & GeometryCollection support to
@turf/truncate
- ๐
@turf/inside
performance increase - Add properties param to
@turf/circle
- Added
bearingToAngle
method to turf-helpers
๐ Bug Fixes
- Fix
@turf/buffer
points in high latitudes - lineIntersect returns the same point several times
@turf/flip
incorrect if z-elevation is present
๐ Changes
๐ Documentation
- Add mutate param to
-
v4.1.0 Changes
๐ New Modules
โจ Enhancements
- โ added centered param to point-grid (PR: https://github.com/Turfjs/turf/pull/650)
- Single
module.export
helpers, invariant & meta (Commit: https://github.com/Turfjs/turf/commit/9cebb2100cf545fec49488c80140909ab54358b5)
๐ Bug Fixes
- Turf.invariant fails on string value as coordinate (PR: https://github.com/Turfjs/turf/pull/643)
- ๐ Handle precision=0 turf-truncate (PR: https://github.com/Turfjs/turf/pull/641)
- โ Added
radiansToDistance
,distanceToRadians
&distanceToDegrees
to Turf core library from@turf/helpers
. (Commit: https://github.com/Turfjs/turf/commit/a88d77a3e7f76860b3c138a716da8b603a407c8e) - โ Removed process.hrtime in
@turf/polygon-unkink
(issue: https://github.com/mclaeysb/simplepolygon/issues/5)
-
v3.6.4 Changes
๐ฆ Typescript definitions
index.d.ts
added to all the packages. -
v3.0.11 Changes
๐ Fix turf-line-slice bug with vertical linestrings.
-
v3.0.1 Changes
๐ This is a big change in Turf! 3.0.0 is a release that targets the development ๐ cycle of Turf, letting us work on it more and release more often.
Monorepo
Turf 3.x and forward is a monorepo project. We publish lots of little modules as usual, but there's one repo - turfjs/turf - that contains all the code and the issues for the Turf source code. We use lerna ๐ฆ to link these packages together and make sure they work.
Why? We already had internal turf modules, like
turf-meta
, and development ๐ was harder and harder - we had a bunch of custom scripts to do releases and โ tests, and these were just written for Turf. Lerna is from the very popular and very well-maintained babel project, and it works really well, and reduces maintainer sadness.Simplicity
Turf grew a bunch of modules that weren't totally necessary, or were expressing only a line or two of JavaScript. We want to make things easier, but these modules didn't make code more expressive and they hid complexity where it didn't need to be hidden. Turf 3.x focuses on the core โ functionalities we need, making sure they're tested and performant.
turf-erase has been renamed turf-difference to make its name more similar to the equivalents in other libraries.
โ Removed modules: merge, sum, min, max, average, median, variance, deviation, filter, remove, jenks, quantile. โฌ๏ธ See the upgrade guide below for replacements.
โฌ๏ธ Upgrading from v2
๐ If you were using turf-merge
๐ turf-merge repeatedly called turf-union on an array of polygons. Here's how to implement the same thing without the special module
var clone = require('clone'); var union = require('turf-union'); function merge(polygons) { var merged = clone(polygons.features[0]), features = polygons.features; for (var i = 0, len = features.length; i < len; i++) { var poly = features[i]; if (poly.geometry) merged = union(merged, poly); } return merged; }
๐ An alternative method that merges pairs of features recursively. With large numbers and similar complexity of input geometries this can speed up run time by factor 10. Choose depending on your use case.
var union = require('turf-union'); function mergeBin(polygons) { var features = polygons.features; do { var merged = [], len = features.length; for (var i = 0; i < len-1; i += 2) { merged.push(turf.union(features[i], features[i+1])); } if (len % 2 !== 0) { merged.push(features[len-1]); } features = merged; } while(features.length > 1); return features[0]; }
If you were using turf-sum, min, max, average, median, variance, deviation
The
turf-collect
method provides the core of these statistical methods and lets you bring your own statistical library, likesimple-statistics
,science.js
, or others.For example, here's how to find the median of matched values with simple-statistics. Finding other statistics, like variance, mean, and so on simply use other methods from the statistics library.
var ss = require('simple-statistics'); var turf = require('@turf/turf'); var poly1 = turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]); var poly2 = turf.polygon([[[10,0],[20,10],[20,20],[20,0],[10,0]]]); var polyFC = turf.featureCollection([poly1, poly2]); var pt1 = turf.point([5,5], {population: 200}); var pt2 = turf.point([1,3], {population: 600}); var pt3 = turf.point([14,2], {population: 100}); var pt4 = turf.point([13,1], {population: 200}); var pt5 = turf.point([19,7], {population: 300}); var ptFC = turf.featureCollection([pt1, pt2, pt3, pt4, pt5]); // collects values from matching points into an array called 'values' var collected = turf.collect(polyFC, ptFC, 'population', 'values'); // finds the median of those values. collected.features.forEach(function (feature) { feature.properties.median = ss.median(feature.properties.values); }); console.log(JSON.stringify(collected, null, 2));
๐ If you were using turf-filter, turf-remove
These modules were thin wrappers around native JavaScript methods: use ๐ Array.filter instead:
var filteredFeatures = features.filter(function(feature) { return feature.properties.value > 10; });
If you were using turf-jenks, turf-quantile
๐ Use Array.map to get values, and then bring your own statistical calculation, like simple-statistics or science.js.
var values = features.map(function(feature) { return feature.properties.value; });
If you were using turf-extent
turf-extent's name was changed to turf-bbox. It is functionally the same.
turf.bbox(poly) // [minx, miny, maxx, maxy]
-
v2.0.0 Changes
- turf-grid renamed turf-point-grid (turf.grid => turf.pointGrid)
- turf-hex renamed turf-hex-grid (turf.hex => turf.hexGrid)
- turf-hex-grid now has a required
unit
parameter - โ remove turf-isobands; use turf-isolines instead
- โ added turf-square-grid (turf.squareGrid)
- โ added turf-triangle-grid (turf.triangleGrid)
- constrain turf-point-grid to the bbox