* Improve boolean-intersects docs * Improving boolean-intersects docs * adding boolean-intersects to documentation.yml * moved addtomap to end and colored markers --------- Co-authored-by: James Beard <james@smallsaucepan.com>
53 KiB
Changelog is no longer maintained. See Turf Github releases
7.0.0
⚠️ Breaking
- Move to @types/geojson package instead of declaring our own. Typescript consumers of Turf will need to import from @types/geojson. (#2158)
- Move distribution JS to target ES2017 (#2237)
- Please change to using named exports instead of default exports from the various packages
@turf/helpersCorrect the conversion factor for degrees (#2177)@turf/helperspolygon() will now throw if the first and last coordinates are not the same (#2173)@turf/helpersSeparate AreaUnits into its own type (#2393)@turf/areaFix earth radius to use WGS84 median earth radius (#2166)@turf/turfRemove re-exports for turf 4.x compatability (#2183)@turf/rectangle-gridFix correctness for large areas (#2106)- `@turf/square-grid Fix correctness for large areas (#2106)
@turf/unionAccept FeatureCollection for multiple inputs (#2247)@turf/differenceAccept FeatureCollection for multiple inputs (#2247)@turf/intersectAccept FeatureCollection for multiple inputs (#2247)@turf/bufferAdd undefined return for when the geometry is invalid (#2613)
🏅 New Features/Enhancements
@turf/kinksMove to sweepline-intersections library for performance (#1896)- `@turf/buffer Reduce bundle size by moving from turf-jsts to @turf/jsts (#2217)
@turf/boolean-equalAdd option for precision (#2231)@turf/boolean-point-in-polygonMove to point-in-polygon-hao library for performance and correctness (#1893)@turf/line-intersectMove to sweepline-intersections library for performance (#2033)@turf/boolean-containsAdd multipolygon support (#2338)@turf/nearest-pointAdd unit option (#2415)@turf/voronoiRetain properties from points (#1450)
🐛 Bug Fixes
@turf/polygon-smoothOptions argument is now actually optional (#2149)@turf/polygon-smoothFix crashes with polygons containing multiple holes (#2323)@turf/line-arcEnsure all points are generated when the first and last points are the same (#2142)@turf/cloneFix cloning of features with null geometries (#2316)@turf/dissolveNow correctly depends on @turf/flatten (#2345)@turf/clean-coordsAllow 3 coordinate closed LineStrings (#2178)@turf/helpersAdd alternate spellings for Units: millimetres, centimetres, metres, kilometres (#2168)@turf/ellipseAdd pivot and angle options to typescript (#2174)@turf/quadrat-analysisFix test flake (#2182)@turf/bboxUse input bbox instead of computing it (#2171)@turf/transform-scaleRemoves invalid bbox when scaling (#2171)@turf/invariantgetCoord now shallow clones its result to prevent accidental mutations (#2167)@turf/line-overlapIdentify multiple overlaps on a single segment (#2134)@turf/transform-scaleFix factor to allow only numbers >= 0 (#2169)@turf/voronoiMake options optional (#2195)@turf/boolean-withinFix multipoint checks (#2216)@turf/points-within-polygonFix dropped properties on MultiPoint results (#2227)@turf/randomThrows error on invalid bbox inputs (#2172)@turf/boolean-parallelLines with 180 degree angle between them are also considered parallel (#2475)@turf/unkink-polygonFix a maximum call stack size exceeded error with very large polygons (#2504)@turf/line-arcNumber of arc segments generated wasn't related to steps value passed in (#2524)@turf/boolean-equalReplace geojson-equality with new implementation (#2531)@turf/boolean-overlapReplace geojson-equality with new implementation (#2531)@turf/boolean-withinNow correctly checks that the final point is contained (#2599)
📖 Documentation
-
@turf/bboxImprove documentation (#2153) -
@turf/great-circleAdd license for arc.js (#2175) -
@turf/boolean-crossesDocument OpenGIS Simple Feature Spec requirement (#2184) -
@turf/turf-cloneNow has more useful Typescript inference (#2239) -
@turf/centroidImprove docs (#2213) -
@turf/bufferClean up Typescript types (#2188) -
@turf/polygon-smoothClean up a typo (#2293) -
@turf/nearest-point-on-lineClean up typescript types (#2296) -
@turf/boolean-touchesAdd boolean-touches to docs (#2431) -
@turf/boolean-equalImprove docs (#2412) -
Remove Bower references (#2146)
-
Fix typo in README (#2313)
-
Lots of cleanup for CONTRIBUTING, README, and RELEASING (#2186)
-
Fix docs generation (#2279)
-
Add a link to turf_dart (#2286)
🔔 Misc
- `@turf/turf Add booleanIntersects typescript export (#2157)
- `@turf/turf Add booleanTouches export (#2170)
- `@turf/turf Add booleanConcave export (#2265)
@turf/simplifyClean up internals for less object churn (#2561)- `@turf/helpers Make isObject a little more accurate (#2176)
- Migrate from geojsonhint to @placemark/check-geojson (#2571)
- Add custom types entry point to exports, required by Typescript for node16, nodenext and bundler module resolution strategies (#2400, #2452)
- types.ts tests are now run in strict mode (#2363)
- Uses tslib now for smaller bundles (#2165)
- Remove object-assign dependency from all packages (#2241)
- Lots of dependencies have been upgraded
6.5.0
🏅 New Features/Enhancements
@turf/points-with-polygonAdd MultiPoint support (PR https://github.com/Turfjs/turf/pull/2137 - Author @twelch)
🐛 Bug Fixes
-
@turf/dissolveComplete rewrite of the dissolve module to resolve many bugs (PR https://github.com/Turfjs/turf/pull/2110 - Author @rowanwins) -
@turf/maskComplete rewrite of the mask module to resolve many bugs (PR https://github.com/Turfjs/turf/pull/2130 - Author @rowanwins) -
@turf/boolean-validAdd missing dependency to (PR https://github.com/Turfjs/turf/pull/2094 - Author @rycgar)
📖 Documentation
@turf/boolean-overlapImprove clarity (PR https://github.com/Turfjs/turf/pull/2133 - Author @patrickbrett)
🔔 Misc
- Enable TS Strict Mode (PR https://github.com/Turfjs/turf/pull/2126 - Author @mfedderly)
6.4.0
🏅 New Features/Enhancements
@turf/boolean-point-on-lineAdded anepislonoption to help in floating point comparison. (PR https://github.com/Turfjs/turf/pull/2051 - Author @okcoker)
🐛 Bug Fixes
-
@turf/line-slice-alongFixed a bug where the offset distance equal to the length of the line (PR https://github.com/Turfjs/turf/pull/2030 - Author @EricPKerr) -
@turf/helpersFixed the conversion ratio for converting meters to yards and vice-versa (PR https://github.com/Turfjs/turf/pull/2046 - Author @anotherhale) -
@turf/center-medianFixed a missing TS type import (PR https://github.com/Turfjs/turf/pull/2044 - Author @Seairth) -
`@turf/bezier-spline Fix a bug ensuring the spline result reaches the end of the input (PR https://github.com/Turfjs/turf/pull/2090 - Author @the-nemz)
📖 Documentation
-
@turf/transform-rotateand@turf/ellipse) Improve documentation for angle parameter (PR https://github.com/Turfjs/turf/pull/2016 - Author @pasieronen) -
@turf/line-chunkFix an invalid anchor (PR https://github.com/Turfjs/turf/pull/2071 - Author @GraxMonzo) -
@turf/distanceEnhance distance doco so supported inputs are clearer (PR https://github.com/Turfjs/turf/pull/2032 - Author @rowanwins)
🔔 Misc
-
@turf/concaveReplace deprecated topojson dependency (PR https://github.com/Turfjs/turf/pull/2037 - Author @elliots) -
Work towards enabling TS Strict Mode (PR https://github.com/Turfjs/turf/pull/2053 - Author @mfedderly)
6.3.0
Fix issues importing Turf for react-native, webpack 5, and other bundlers
(PR https://github.com/Turfjs/turf/pull/2004 - Author r0b0t3d) (PR https://github.com/Turfjs/turf/pull/2011 - Author mfedderly)
[@turf/turf][turf] expose @turf/boolean-intersect
(PR https://github.com/Turfjs/turf/pull/2007 - Author rowanwins)
6.2.0
After a bit of hiatus, TurfJS is resuming releases.
⭐️ Major Updates
- ES Modules available for all packages
- Tree shaking should significantly reduce import size of @turf/turf
- Better support for ESM modules (PR https://github.com/Turfjs/turf/pull/1942 - Author @diachedelic)
- Clean-up of test and benchmark running to make publishing easier
- Enforce styling using Prettier
- Enable ESLint and get rid of unused variables
- Upgrade rollup for more correct javascript module builds
- Only include ES5 code
🚀 New Modules
[@turf/boolean-touches][boolean-touches]
Determines if two features touch but do not intersect
[@turf/boolean-valid][boolean-valid]
Checks if the geometry is a valid according to the OGC Simple Feature Specification
[@turf/quadrat-analysis][quadrat-analysis]
Performs a quadrat analysis on a set of points
[@turf/rectangle-grid][rectangle-grid]
Creates a grid of rectangles from a bounding box
@turf/voroni
Typescript types for the options parameter have been fixed (PR https://github.com/Turfjs/turf/pull/1424 - Author @stevage)
@turf/points-within-polygon
Typescript types around the Feature's Properties will now be preserved. (PR https://github.com/Turfjs/turf/pull/1761 - Author @rugheid)
@turf/rewind
Typescript types for the 'reverse' option are now correct. Previously it was misnamed as 'reversed'. (PR https://github.com/Turfjs/turf/pull/1786 - Author @jonnycornwell)
@turf/difference
No longer publishes an .mjs file.
@turf/meta
No longer publishes an .mjs file.
@turf/tag
Add MultiPolygon support. (PR https://github.com/Turfjs/turf/pull/1996 - Author bryceroney)
🐛 Bug Fixes
-
@turf/centroidDon't visit first point twice when calculating centroid (PR https://github.com/Turfjs/turf/pull/1894 - Author @rowanwins) -
@turf/transform-translateBetter handling of negative distances (PR https://github.com/Turfjs/turf/pull/1895 - Author @rowanwins) -
@turf/union,@turf/difference,@turf/intersectUse polygon-clipping library to fix correctness issues (PR https://github.com/Turfjs/turf/pull/1916 - Authors @mbullington, @ngottlieb) -
@turf/bufferChange default number of steps to 8, and actually support the steps option (PR https://github.com/Turfjs/turf/pull/1931 - Author stevenchanin) -
@turf/bufferFix projection issues that produce undersized buffers at non-equatorial latitudes (PR https://github.com/Turfjs/turf/pull/1956 - Author dyakovlev) -
@turf/helpersAdd runtime checks to point() method, fixing an API break (PR https://github.com/Turfjs/turf/pull/1964)
🏅 New Features/Enhancements
-
@turf/boolean-overlapBetter performance for MultiPoint geometries (PR https://github.com/Turfjs/turf/pull/1910 - Author @mfedderly) -
@turf/helpersAdd hectares to convertArea (PR https://github.com/Turfjs/turf/pull/1943 - Author @DanielJDufour) -
@turf/great-circleUpdate Typescript types to support MultiLineString input (PR https://github.com/Turfjs/turf/pull/1928 - Author kronick)
📖 Documentation
-
@turf/square-gridClarify inputs (PR https://github.com/Turfjs/turf/pull/1885 - Author @raphael-leger) -
@turf/greater-circleClarify properties option example (PR https://github.com/Turfjs/turf/pull/1888 - Author @chris-catignani)
⚠️ Breaking Change
-
@turf/line-to-polygonno longer modifies its input unless the mutate option is true (PR https://github.com/Turfjs/turf/pull/1879 - Author @MortenBirk) -
@turf/unkink-polygonremove Number.prototype.modulo override (PR https://github.com/Turfjs/turf/pull/1978)
5.0.0 🎉
⭐️ Major Updates
- TurfJS now supports ES Modules (Related PR's)
- Optional parameters are now defined as an
Object.
🚀 New Modules
@turf/voronoi
Takes a FeatureCollection of points, and a bounding box, and returns a FeatureCollection of Voronoi polygons. (PR https://github.com/Turfjs/turf/pull/1043 - Author @stevage)
@turf/shortest-path
Returns the shortest path from start to end without colliding with any feature in obstacles (PR https://github.com/Turfjs/turf/pull/956 - Author @stebogit)
@turf/boolean-parallel
Boolean-Parallel returns True if each segment of line1 is parallel to the correspondent segment of line2
(PR https://github.com/Turfjs/turf/pull/941 - Author @stebogit)
@turf/nearest-point-on-line
Takes a {@link Point} and a {@link LineString} and calculates the closest Point on the (Multi)LineString. (PR https://github.com/Turfjs/turf/pull/939 - Author @stebogit)
🏅 New Features/Enhancements
-
Updates
@turf/unkink-polygontesting & addedflattenEachinstead of usingflatten. (PR https://github.com/Turfjs/turf/pull/889) -
Add multi-geomtry support to
@turf/line-split(PR https://github.com/Turfjs/turf/pull/1078) -
Improve
@turf/metalineEachmethod to provide properties, id and bbox (PR https://github.com/Turfjs/turf/pull/1010)
🐛 Bug Fixes
-
Fixes
@turf/helpersearth radius variable (PR https://github.com/Turfjs/turf/pull/1012) -
Fixes
@turf/polygon-tangentsbug (PR https://github.com/Turfjs/turf/pull/1058) -
Fixes
@turf/line-chunkbug when the number of segments is integer (PR https://github.com/Turfjs/turf/pull/1046) -
Fixes
segmentEachandsegmentReducemethods in@turf/metato ensure something is returned (PR https://github.com/Turfjs/turf/pull/968)
⚠️ Breaking Change
- Optional parameters are now defined as an
Object:
Before
var from = [-75.343, 39.984];
var to = [-75.534, 39.123];
var units = 'miles';
var distance = turf.distance(from, to, units);
After
var from = [-75.343, 39.984];
var to = [-75.534, 39.123];
var options = {units: 'miles'};
var distance = turf.distance(from, to, options);
- Reworked
@turf/randomPR https://github.com/Turfjs/turf/issues/994 - Deprecate
@turf/idwIssue https://github.com/Turfjs/turf/issues/887 - Reworked Grid modules
@turf/point-grid/hex/square/trianglePR https://github.com/Turfjs/turf/pull/1029 - Renamed Modules/Methods
@turf/inside=>@turf/boolean-point-in-polygonhttps://github.com/Turfjs/turf/issues/860#issuecomment-317216235@turf/within=>@turf/points-within-polygonhttps://github.com/Turfjs/turf/issues/860#issuecomment-317216235@turf/bezier=>@turf/bezier-splineIssue https://github.com/Turfjs/turf/issues/661@turf/nearest=>@turf/nearest-pointhttps://github.com/Turfjs/turf/pull/858#issuecomment-317197295@turf/point-on-line=>@turf/nearest-point-on-linehttps://github.com/Turfjs/turf/pull/858#issuecomment-317197295@turf/lineDistance=>@turf/lengthhttps://github.com/Turfjs/turf/issues/860#issuecomment-317229869@turf/helpersradians2degrees=>radiansToDegreesdegrees2radians=>degreesToRadiansdistanceToDegrees=>lengthToDegreesdistanceToRadians=>lengthToRadiansradiansToDistance=>radiansToLengthbearingToAngle=>bearingToAzimuthconvertDistance=>convertLength
4.7.0
🚀 New Modules
@turf/projection
- toMercator: Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
- toWgs84: Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
(PR https://github.com/Turfjs/turf/pull/927 - Author @stebogit)
@turf/point-to-line-distance
Returns the minimum distance between a {@link Point} and a {@link LineString}, being the distance from a line the minimum distance between the point and any segment of the LineString.
(PR https://github.com/Turfjs/turf/pull/925 - Author @stebogit)
@turf/boolean-within
Boolean-within returns true if the first geometry is completely within the second geometry. The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a) must not intersect the exterior of the secondary (geometry b). Boolean-within returns the exact opposite result of the @turf/boolean-contains.
(PR https://github.com/Turfjs/turf/pull/924 - Author @rowanwins)
🏅 New Features/Enhancements
- Updates
@turf/unkink-polygontesting & addedflattenEachinstead of usingflatten. (PR https://github.com/Turfjs/turf/pull/889) @turf/concaverefactoring, replacing@turf/unionwithgeojson-dissolveto increase speed and added support tonullgeometries (PR https://github.com/Turfjs/turf/pull/907 - Contributor @stebogit @DenisCarriere)- Adds doc note on
@turf/polygonizeabout "Edges must be correctly noded" (PR https://github.com/Turfjs/turf/pull/898 - Contributor @stebogit @NickCis) - Adds support to foreign Members to
@turf/clone(PR https://github.com/Turfjs/turf/pull/904 - Contributor @DenisCarriere) - Extends support of any
GeoJSONto@turf/simplify(PR https://github.com/Turfjs/turf/pull/903 - Contributor @DenisCarriere @stebogit) - Adds new
isNumberfunction and improves type checking for few@turf/helpersmethods (PR https://github.com/Turfjs/turf/pull/920 - Contributor @DenisCarriere @stebogit) - Adds throw errors to invalid
MultiPolygonsfor@turf/simplify(PR https://github.com/Turfjs/turf/pull/922 - Contributor @DenisCarriere)
🐛 Bug Fixes
- Fixes
@turf/bbox-clippoint intersection handling, adding sanity-checks the lineclip output (PR https://github.com/Turfjs/turf/pull/886) - Fixes
@turf/line-splitendpoint case handling applying@turf/truncateonsplitter(PR https://github.com/Turfjs/turf/pull/892 and https://github.com/Turfjs/turf/pull/855 - Contributor @stebogit) - Fixes
@turf/intersectthrowing "uncaught exception", adding@turf/truncateto inputs and returningFeature<null>if no geometry (PR https://github.com/Turfjs/turf/pull/890 - Contributor @stebogit @vicvolk) - Fixes
@turf/hex-gridnot properly cloning the last ring vertex (PR https://github.com/Turfjs/turf/pull/897 - Contributor @stebogit @DenisCarriere) - Fixes
@turf/boolean-disjointincorrect behaviour where a poly was completely contained within another poly (PR https://github.com/Turfjs/turf/pull/908 - Contributor @rowanwins) - Fixes
@turf/simplifyprocess pending on particular geometries, applying@turf/clean-coordsto input. (PR https://github.com/Turfjs/turf/pull/903 - Contributor @stebogit @DenisCarriere) - Fixes
booleanproperties not being translated with@turf/clone(PR https://github.com/Turfjs/turf/pull/909 - Contributor @DenisCarriere) - Fixes
@turf/boolean-containsincorrect output when checking two polygons (PR https://github.com/Turfjs/turf/pull/923 - Contributor @rowanwins @DenisCarriere)
4.6.0
🚀 New Modules
@turf/clean-coordsRemoves redundant coordinates from any GeoJSON Geometry. (PR https://github.com/Turfjs/turf/pull/875 - Author @stebogit)@turf/interpolateTakes 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-dbscanTakes 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/clustersProvidesgetCluster,clusterEach, andclusterReducefunctions. (PR https://github.com/Turfjs/turf/pull/847 - Author @DenisCarriere)@turf/boolean-point-on-lineReturns 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-overlapTakes 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-equalDetermine 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
centeredparam default totruein@turf/point-grid(PR https://github.com/Turfjs/turf/pull/836 - Contributor @stebogit) - Adds
MultiLineStringsupport 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/clusters@4.5.2(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
segmentEachandsegmentReducefunctions 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
nullGeometry 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
bboxandidparams plusgeometrymethod to@turf/helpers(PR https://github.com/Turfjs/turf/issues/877 - Contributor @DenisCarriere)
🐛 Bug Fixes
- Applies
@turf/truncateto@turf/line-splitsplitterinput to avoid approximation errors. Fixed #852 (PR https://github.com/Turfjs/turf/pull/855) - Fixes
@turf-maskerror (See Issue https://github.com/Turfjs/turf/issues/837) (PR https://github.com/Turfjs/turf/pull/865 - Contributor @thiagoxvo) - Fixes
create-new-modulescript error onLICENSEfile creation (See Issue https://github.com/Turfjs/turf/issues/861) (commit df6986e) - Fixes
@turf/isobandserror oncommonProperties(See Issue https://github.com/Turfjs/turf/issues/831) (commit 1663f07)
4.5.0
🚀 New Modules
-
@turf/clustersTakes 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-disjointBoolean-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-containsBoolean-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-crossesBoolean-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-clockwiseTakes 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/clonePrevents 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
convertAreaConverts 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/idwbad 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)
4.4.0
🚀 New Modules
@turf/line-offsetAdds 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/polygonizePolygonizes (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-rotateRotates 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-translateMoves 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-scaleScale 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/centroidand@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
Tapat 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-destinationissue 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)
4.3.0
🚀 New Modules
- Rhumb Line Modules (https://github.com/Turfjs/turf/pull/728)
@turf/polygon-tangentsFinds the tangents of a (Multi)Polygon from a Point. (https://github.com/Turfjs/turf/pull/708)@turf/rewindRewind LineString or Polygon outer ringclockwisecounter-clockwise and inner ringscounterclockwiseclockwise (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&getGeomTypein@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/circletranslate properties (https://github.com/Turfjs/turf/pull/717) - Apply equidistance
@turf/bufferto 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
radiusto@turf/buffer(https://github.com/Turfjs/turf/pull/736)
4.2.0
New Modules
Enhancements
- Add mutate param to
@turf/flip - Add Geometry & GeometryCollection support to
@turf/truncate @turf/insideperformance increase- Add properties param to
@turf/circle - Added
bearingToAnglemethod to turf-helpers
Bug Fixes
- Fix
@turf/bufferpoints in high latitudes - lineIntersect returns the same point several times
@turf/flipincorrect if z-elevation is present
Changes
Documentation
4.1.0
New Modules
Enhancements
- added centered param to point-grid (PR: https://github.com/Turfjs/turf/pull/650)
- Single
module.exporthelpers, invariant & meta (Commit:9cebb2100c)
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&distanceToDegreesto Turf core library from@turf/helpers. (Commit:a88d77a3e7) - Removed process.hrtime in
@turf/polygon-unkink(issue: https://github.com/mclaeysb/simplepolygon/issues/5)
3.6.4
Typescript definitions index.d.ts added to all the packages.
3.0.11
Fix turf-line-slice bug with vertical linestrings.
3.0.1
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, like simple-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]
2.0.0
- 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
unitparameter - 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
1.4.0
- update all module dependencies to master
- add support for features in turf.intersection
- fix issues with turf.polygon coordinate wrapping inconsistencies
- add
unitparameter to turf.concave
1.3.5
- harmonize turf-tin dependency tree
1.3.4
- fixes bug in turf-along
1.3.3
- added turf-line-slice for segmenting LineStrings with Points
- turf-point-on-line for calculating the closest Point from a Point to a LineString
1.3.2
- tin ~7x faster
- Fix mutability issues with
flip,erase: data passed to Turf should never be changed in place. - added turf-line-distance for geodesic measuring of LineStrings
- added turf-along for calculating a the location of a Point x distance along a LineString
- added turf-area for calculating the area of a given feature