diff --git a/eslint.config.mjs b/eslint.config.mjs index 91012a564f..f04c319949 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -71,17 +71,5 @@ export default tsEslint.config( }, }, }, - { - files: [ - "packages/turf-isobands/lib/marchingsquares-isobands.js", - "packages/turf-isolines/lib/marchingsquares-isocontours.js", - ], - - languageOptions: { - globals: { - ...globals.browser, - }, - }, - }, prettierRecommended ); diff --git a/packages/turf-isobands/package.json b/packages/turf-isobands/package.json index e5387b9a4c..6cc27da302 100644 --- a/packages/turf-isobands/package.json +++ b/packages/turf-isobands/package.json @@ -4,7 +4,8 @@ "description": "Takes a grid of values (GeoJSON format) and a set of threshold ranges. It outputs polygons that group areas within those ranges, effectively creating filled contour isobands.", "author": "Turf Authors", "contributors": [ - "Stefano Borghi <@stebogit>" + "Stefano Borghi <@stebogit>", + "Matt Fedderly <@mfedderly>" ], "license": "MIT", "bugs": { diff --git a/packages/turf-isolines/index.ts b/packages/turf-isolines/index.ts index 2bf41aaa5c..105ba99900 100644 --- a/packages/turf-isolines/index.ts +++ b/packages/turf-isolines/index.ts @@ -2,8 +2,6 @@ import { bbox } from "@turf/bbox"; import { coordEach } from "@turf/meta"; import { collectionOf } from "@turf/invariant"; import { multiLineString, featureCollection, isObject } from "@turf/helpers"; -// @ts-expect-error Legacy JS library with no types defined -import { isoContours } from "marchingsquares"; import { gridToMatrix } from "./lib/grid-to-matrix.js"; import { FeatureCollection, @@ -11,6 +9,7 @@ import { MultiLineString, Feature, GeoJsonProperties, + Position, } from "geojson"; /** @@ -70,6 +69,10 @@ function isolines( // Isoline methods const matrix = gridToMatrix(pointGrid, { zProperty: zProperty, flip: true }); + // A quick note on what 'top' and 'bottom' mean in coordinate system of `matrix`: + // Remember that the southern hemisphere is represented by negative numbers, + // so a matrix Y of 0 is actually the *bottom*, and a Y of dy - 1 is the *top*. + // check that the resulting matrix has consistent x and y dimensions and // has at least a 2x2 size so that we can actually build grid squares const dx = matrix[0].length; @@ -122,18 +125,226 @@ function createIsoLines( const properties = { ...commonProperties, ...breaksProperties[i] }; properties[zProperty] = threshold; - // Pass options to marchingsquares lib to reproduce historical turf - // behaviour. - const isoline = multiLineString( - isoContours(matrix, threshold, { linearRing: false, noFrame: true }), - properties - ); + const isoline = multiLineString(isoContours(matrix, threshold), properties); results.push(isoline); } return results; } +function isoContours( + matrix: ReadonlyArray>, + threshold: number +): Position[][] { + // see https://en.wikipedia.org/wiki/Marching_squares + const segments: [Position, Position][] = []; + + const dy = matrix.length; + const dx = matrix[0].length; + + for (let y = 0; y < dy - 1; y++) { + for (let x = 0; x < dx - 1; x++) { + const tr = matrix[y + 1][x + 1]; + const br = matrix[y][x + 1]; + const bl = matrix[y][x]; + const tl = matrix[y + 1][x]; + + let grid = + (tl >= threshold ? 8 : 0) | + (tr >= threshold ? 4 : 0) | + (br >= threshold ? 2 : 0) | + (bl >= threshold ? 1 : 0); + + switch (grid) { + case 0: + continue; + case 1: + segments.push([ + [x + frac(bl, br), y], + [x, y + frac(bl, tl)], + ]); + break; + case 2: + segments.push([ + [x + 1, y + frac(br, tr)], + [x + frac(bl, br), y], + ]); + break; + case 3: + segments.push([ + [x + 1, y + frac(br, tr)], + [x, y + frac(bl, tl)], + ]); + break; + case 4: + segments.push([ + [x + frac(tl, tr), y + 1], + [x + 1, y + frac(br, tr)], + ]); + break; + case 5: { + // use the average of the 4 corners to differentiate the saddle case and correctly honor the counter-clockwise winding + const avg = (tl + tr + br + bl) / 4; + const above = avg >= threshold; + + if (above) { + segments.push( + [ + [x + frac(tl, tr), y + 1], + [x, y + frac(bl, tl)], + ], + [ + [x + frac(bl, br), y], + [x + 1, y + frac(br, tr)], + ] + ); + } else { + segments.push( + [ + [x + frac(tl, tr), y + 1], + [x + 1, y + frac(br, tr)], + ], + [ + [x + frac(bl, br), y], + [x, y + frac(bl, tl)], + ] + ); + } + break; + } + case 6: + segments.push([ + [x + frac(tl, tr), y + 1], + [x + frac(bl, br), y], + ]); + break; + case 7: + segments.push([ + [x + frac(tl, tr), y + 1], + [x, y + frac(bl, tl)], + ]); + break; + case 8: + segments.push([ + [x, y + frac(bl, tl)], + [x + frac(tl, tr), y + 1], + ]); + break; + case 9: + segments.push([ + [x + frac(bl, br), y], + [x + frac(tl, tr), y + 1], + ]); + break; + case 10: { + const avg = (tl + tr + br + bl) / 4; + const above = avg >= threshold; + + if (above) { + segments.push( + [ + [x, y + frac(bl, tl)], + [x + frac(bl, br), y], + ], + [ + [x + 1, y + frac(br, tr)], + [x + frac(tl, tr), y + 1], + ] + ); + } else { + segments.push( + [ + [x, y + frac(bl, tl)], + [x + frac(tl, tr), y + 1], + ], + [ + [x + 1, y + frac(br, tr)], + [x + frac(bl, br), y], + ] + ); + } + break; + } + case 11: + segments.push([ + [x + 1, y + frac(br, tr)], + [x + frac(tl, tr), y + 1], + ]); + break; + case 12: + segments.push([ + [x, y + frac(bl, tl)], + [x + 1, y + frac(br, tr)], + ]); + break; + case 13: + segments.push([ + [x + frac(bl, br), y], + [x + 1, y + frac(br, tr)], + ]); + break; + case 14: + segments.push([ + [x, y + frac(bl, tl)], + [x + frac(bl, br), y], + ]); + break; + case 15: + // all above + continue; + } + } + } + + const contours: Position[][] = []; + + while (segments.length > 0) { + const contour: Position[] = [...segments.shift()!]; + contours.push(contour); + + let found: boolean; + do { + found = false; + for (let i = 0; i < segments.length; i++) { + const segment = segments[i]; + // add the segment's end point to the end of the contour + if ( + segment[0][0] === contour[contour.length - 1][0] && + segment[0][1] === contour[contour.length - 1][1] + ) { + found = true; + contour.push(segment[1]); + segments.splice(i, 1); + break; + } + // add the segment's start point to the start of the contour + if ( + segment[1][0] === contour[0][0] && + segment[1][1] === contour[0][1] + ) { + found = true; + contour.unshift(segment[0]); + segments.splice(i, 1); + break; + } + } + } while (found); + } + + return contours; + + // get the linear interpolation fraction of how far z is between z0 and z1 + // See https://github.com/fschutt/marching-squares/blob/master/src/lib.rs + function frac(z0: number, z1: number): number { + if (z0 === z1) { + return 0.5; + } + + let t = (threshold - z0) / (z1 - z0); + return t > 1 ? 1 : t < 0 ? 0 : t; + } +} + /** * Translates and scales isolines * diff --git a/packages/turf-isolines/package.json b/packages/turf-isolines/package.json index 60920c2c8c..5cd6d354df 100644 --- a/packages/turf-isolines/package.json +++ b/packages/turf-isolines/package.json @@ -4,7 +4,8 @@ "description": "Generate contour lines from a grid of data.", "author": "Turf Authors", "contributors": [ - "Stefano Borghi <@stebogit>" + "Stefano Borghi <@stebogit>", + "Matt Fedderly <@mfedderly>" ], "license": "MIT", "bugs": { @@ -79,7 +80,6 @@ "@turf/invariant": "workspace:*", "@turf/meta": "workspace:*", "@types/geojson": "^7946.0.10", - "marchingsquares": "^1.3.3", "tslib": "^2.8.1" } } diff --git a/packages/turf-isolines/test/out/bigMatrix.geojson b/packages/turf-isolines/test/out/bigMatrix.geojson index 529690781b..d02cc96932 100644 --- a/packages/turf-isolines/test/out/bigMatrix.geojson +++ b/packages/turf-isolines/test/out/bigMatrix.geojson @@ -14,47 +14,119 @@ "type": "MultiLineString", "coordinates": [ [ - [6.638495, 49.179071], - [6.5, 49.161809] + [13.333575, 46.719456], + [13.424768, 46.665438], + [13.467696, 46.629524], + [13.52061, 46.539592], + [13.551757, 46.44966], + [13.563264, 46.386354], + [13.567553, 46.359728], + [13.564023, 46.269796], + [13.563264, 46.267861], + [13.527199, 46.179864], + [13.426546, 46.089932], + [13.424768, 46.088913], + [13.286273, 46.043257], + [13.147778, 46.040078], + [13.009282, 46.076361], + [12.98133, 46.089932], + [12.870787, 46.176678], + [12.867497, 46.179864], + [12.815364, 46.269796], + [12.792558, 46.359728], + [12.794113, 46.44966], + [12.817878, 46.539592], + [12.870787, 46.625291], + [12.873239, 46.629524], + [13.003638, 46.719456], + [13.009282, 46.72173], + [13.147778, 46.750639], + [13.286273, 46.736988], + [13.333575, 46.719456] ], [ - [6.5, 49.444426], - [6.596926, 49.507349] + [14.586932, 46], + [14.671227, 46.0847], + [14.684441, 46.089932], + [14.809722, 46.118811], + [14.948217, 46.095223], + [14.9629, 46.089932], + [15.073333, 46] ], [ - [6.776991, 49.222896], - [6.638495, 49.179071] + [15.248809, 46], + [15.363703, 46.074808], + [15.404796, 46.089932], + [15.502199, 46.131327], + [15.5712, 46.179864], + [15.640694, 46.214118], + [15.77919, 46.265899], + [15.917685, 46.245906], + [16.004625, 46.179864], + [16.019208, 46.089932], + [15.989697, 46] ], [ - [6.805692, 49.237553], - [6.776991, 49.222896] + [19.261103, 46.269796], + [19.241574, 46.261638], + [19.227967, 46.269796], + [19.241574, 46.28155], + [19.261103, 46.269796] ], [ - [6.915486, 49.311577], - [6.805692, 49.237553] + [17.483942, 46.539592], + [17.441134, 46.509911], + [17.398412, 46.539592], + [17.441134, 46.565069], + [17.483942, 46.539592] ], [ - [6.932951, 49.327485], - [6.915486, 49.311577] + [18.274679, 46.539592], + [18.272106, 46.539023], + [18.271836, 46.539592], + [18.272106, 46.540117], + [18.274679, 46.539592] ], [ - [6.994818, 49.417417], - [6.932951, 49.327485] + [16.983186, 46.629524], + [16.887153, 46.616213], + [16.866868, 46.629524], + [16.887153, 46.686717], + [16.983186, 46.629524] ], [ - [7.017371, 49.507349], - [6.994818, 49.417417] + [12.496746, 47.079184], + [12.532649, 46.989252], + [12.464469, 46.89932], + [12.455301, 46.893482], + [12.316805, 46.859784], + [12.17831, 46.898495], + [12.177161, 46.89932], + [12.112964, 46.989252], + [12.154879, 47.079184], + [12.17831, 47.097102], + [12.316805, 47.14904], + [12.455301, 47.13561], + [12.496746, 47.079184] + ], + [ + [15.664979, 47.259049], + [15.77919, 47.222509], + [15.834548, 47.169116], + [15.789098, 47.079184], + [15.77919, 47.072803], + [15.640694, 47.070845], + [15.606895, 47.079184], + [15.502199, 47.115385], + [15.363703, 47.167282], + [15.361223, 47.169116], + [15.336906, 47.259049], + [15.363703, 47.279081], + [15.502199, 47.319692], + [15.640694, 47.267231], + [15.664979, 47.259049] ], [ - [7.469468, 47.539233], - [7.398672, 47.618777], - [7.369353, 47.708709], - [7.392465, 47.798641], - [7.469468, 47.873837], - [7.49141, 47.888573], - [7.607963, 47.931492], - [7.746458, 47.938693], - [7.884954, 47.89919], [7.899188, 47.888573], [8.000611, 47.798641], [8.023449, 47.751713], @@ -78,18 +150,38 @@ [7.607963, 47.432938], [7.602787, 47.438913], [7.483616, 47.528845], - [7.469468, 47.539233] + [7.469468, 47.539233], + [7.398672, 47.618777], + [7.369353, 47.708709], + [7.392465, 47.798641], + [7.469468, 47.873837], + [7.49141, 47.888573], + [7.607963, 47.931492], + [7.746458, 47.938693], + [7.884954, 47.89919], + [7.899188, 47.888573] + ], + [ + [12.559982, 47.348981], + [12.579726, 47.259049], + [12.455301, 47.183226], + [12.329096, 47.259049], + [12.352189, 47.348981], + [12.455301, 47.385966], + [12.559982, 47.348981] + ], + [ + [14.897997, 47.348981], + [14.890392, 47.259049], + [14.809722, 47.2071], + [14.671227, 47.203042], + [14.575353, 47.259049], + [14.565439, 47.348981], + [14.671227, 47.417355], + [14.809722, 47.411845], + [14.897997, 47.348981] ], [ - [8.854421, 47.393577], - [8.767107, 47.438913], - [8.738554, 47.528845], - [8.774536, 47.618777], - [8.779112, 47.708709], - [8.805405, 47.798641], - [8.854421, 47.854382], - [8.942356, 47.888573], - [8.992917, 47.908661], [9.101873, 47.888573], [9.131412, 47.87878], [9.212607, 47.798641], @@ -99,207 +191,198 @@ [9.17041, 47.438913], [9.131412, 47.412762], [8.992917, 47.372654], - [8.854421, 47.393577] - ], - [ - [12.17831, 46.898495], - [12.177161, 46.89932], - [12.112964, 46.989252], - [12.154879, 47.079184], - [12.17831, 47.097102], - [12.316805, 47.14904], - [12.455301, 47.13561], - [12.496746, 47.079184], - [12.532649, 46.989252], - [12.464469, 46.89932], - [12.455301, 46.893482], - [12.316805, 46.859784], - [12.17831, 46.898495] + [8.854421, 47.393577], + [8.767107, 47.438913], + [8.738554, 47.528845], + [8.774536, 47.618777], + [8.779112, 47.708709], + [8.805405, 47.798641], + [8.854421, 47.854382], + [8.942356, 47.888573], + [8.992917, 47.908661], + [9.101873, 47.888573] ], [ + [12.360972, 47.528845], [12.316805, 47.48062], [12.274592, 47.528845], [12.316805, 47.539311], - [12.360972, 47.528845], - [12.316805, 47.48062] + [12.360972, 47.528845] ], [ - [12.455301, 47.183226], - [12.329096, 47.259049], - [12.352189, 47.348981], - [12.455301, 47.385966], - [12.559982, 47.348981], - [12.579726, 47.259049], - [12.455301, 47.183226] + [16.668716, 47.618777], + [16.610162, 47.604288], + [16.590133, 47.618777], + [16.610162, 47.644458], + [16.668716, 47.618777] ], [ + [12.765117, 48.158369], + [12.842427, 48.068437], [12.732292, 48.019172], [12.607371, 48.068437], [12.69843, 48.158369], [12.732292, 48.169413], - [12.765117, 48.158369], - [12.842427, 48.068437], - [12.732292, 48.019172] - ], - [ - [12.870787, 46.176678], - [12.867497, 46.179864], - [12.815364, 46.269796], - [12.792558, 46.359728], - [12.794113, 46.44966], - [12.817878, 46.539592], - [12.870787, 46.625291], - [12.873239, 46.629524], - [13.003638, 46.719456], - [13.009282, 46.72173], - [13.147778, 46.750639], - [13.286273, 46.736988], - [13.333575, 46.719456], - [13.424768, 46.665438], - [13.467696, 46.629524], - [13.52061, 46.539592], - [13.551757, 46.44966], - [13.563264, 46.386354], - [13.567553, 46.359728], - [13.564023, 46.269796], - [13.563264, 46.267861], - [13.527199, 46.179864], - [13.426546, 46.089932], - [13.424768, 46.088913], - [13.286273, 46.043257], - [13.147778, 46.040078], - [13.009282, 46.076361], - [12.98133, 46.089932], - [12.870787, 46.176678] + [12.765117, 48.158369] ], [ - [14.586932, 46], - [14.671227, 46.0847], - [14.684441, 46.089932], - [14.809722, 46.118811], - [14.948217, 46.095223], - [14.9629, 46.089932], - [15.073333, 46] + [7.017371, 49.507349], + [6.994818, 49.417417], + [6.932951, 49.327485], + [6.915486, 49.311577], + [6.805692, 49.237553], + [6.776991, 49.222896], + [6.638495, 49.179071], + [6.5, 49.161809] ], [ - [14.671227, 47.203042], - [14.575353, 47.259049], - [14.565439, 47.348981], - [14.671227, 47.417355], - [14.809722, 47.411845], - [14.897997, 47.348981], - [14.890392, 47.259049], - [14.809722, 47.2071], - [14.671227, 47.203042] - ], + [6.5, 49.444426], + [6.596926, 49.507349] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke-width": 4, + "fill-opacity": 0.4, + "stroke": "blue", + "fill": "blue", + "pressure": 0.5 + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [ [ - [15.248809, 46], - [15.363703, 46.074808], - [15.404796, 46.089932], - [15.502199, 46.131327], - [15.5712, 46.179864], - [15.640694, 46.214118], - [15.77919, 46.265899], - [15.917685, 46.245906], - [16.004625, 46.179864], - [16.019208, 46.089932], - [15.989697, 46] - ], - [ - [15.363703, 47.167282], - [15.361223, 47.169116], - [15.336906, 47.259049], - [15.363703, 47.279081], - [15.502199, 47.319692], - [15.640694, 47.267231], - [15.664979, 47.259049], - [15.77919, 47.222509], - [15.834548, 47.169116], - [15.789098, 47.079184], - [15.77919, 47.072803], - [15.640694, 47.070845], - [15.606895, 47.079184], - [15.502199, 47.115385], - [15.363703, 47.167282] + [12.683417, 46], + [12.593796, 46.075577], + [12.578669, 46.089932], + [12.510938, 46.179864], + [12.469615, 46.269796], + [12.455301, 46.327499], + [12.446405, 46.359728], + [12.435651, 46.44966], + [12.429156, 46.539592], + [12.394556, 46.629524], + [12.316805, 46.66745], + [12.206125, 46.719456], + [12.17831, 46.726561], + [12.040741, 46.809388], + [12.039815, 46.810095], + [11.968106, 46.89932], + [11.950779, 46.989252], + [11.986492, 47.079184], + [12.039815, 47.132358], + [12.085344, 47.169116], + [12.17831, 47.258912], + [12.178407, 47.259049], + [12.228722, 47.348981], + [12.286307, 47.438913], + [12.227878, 47.528845], + [12.316805, 47.550894], + [12.409847, 47.528845], + [12.455301, 47.439296], + [12.456106, 47.438913], + [12.593796, 47.396831], + [12.681485, 47.348981], + [12.723597, 47.259049], + [12.726633, 47.169116], + [12.732292, 47.136674], + [12.746385, 47.079184], + [12.792784, 46.989252], + [12.870787, 46.917991], + [13.009282, 46.903932], + [13.147778, 46.899728], + [13.151005, 46.89932], + [13.286273, 46.885734], + [13.424768, 46.851978], + [13.525358, 46.809388], + [13.563264, 46.789296], + [13.664117, 46.719456], + [13.701759, 46.68041], + [13.749338, 46.629524], + [13.804668, 46.539592], + [13.838909, 46.44966], + [13.840254, 46.442365], + [13.858366, 46.359728], + [13.858124, 46.269796], + [13.840254, 46.206993], + [13.833446, 46.179864], + [13.782815, 46.089932], + [13.701759, 46.015819], + [13.682327, 46] ], [ - [16.610162, 47.604288], - [16.590133, 47.618777], - [16.610162, 47.644458], - [16.668716, 47.618777], - [16.610162, 47.604288] + [14.369931, 46], + [14.394236, 46.040341], + [14.418486, 46.089932], + [14.532731, 46.170845], + [14.552367, 46.179864], + [14.671227, 46.22058], + [14.809722, 46.23732], + [14.948217, 46.232071], + [15.086713, 46.218284], + [15.225208, 46.226715], + [15.363703, 46.263342], + [15.380442, 46.269796], + [15.502199, 46.304995], + [15.640694, 46.338291], + [15.77919, 46.349711], + [15.917685, 46.330436], + [16.049628, 46.269796], + [16.05618, 46.26467], + [16.128158, 46.179864], + [16.150722, 46.089932], + [16.136546, 46] ], [ - [16.887153, 46.616213], - [16.866868, 46.629524], - [16.887153, 46.686717], - [16.983186, 46.629524], - [16.887153, 46.616213] + [19.311629, 46.269796], + [19.241574, 46.240533], + [19.192764, 46.269796], + [19.241574, 46.311959], + [19.311629, 46.269796] ], [ - [17.441134, 46.509911], - [17.398412, 46.539592], - [17.441134, 46.565069], - [17.483942, 46.539592], - [17.441134, 46.509911] + [17.53461, 46.539592], + [17.441134, 46.474778], + [17.347844, 46.539592], + [17.441134, 46.595224], + [17.53461, 46.539592] ], [ - [18.272106, 46.539023], - [18.271836, 46.539592], - [18.272106, 46.540117], - [18.274679, 46.539592], - [18.272106, 46.539023] + [18.342339, 46.539592], + [18.272106, 46.524045], + [18.264737, 46.539592], + [18.272106, 46.553925], + [18.342339, 46.539592] ], [ - [19.241574, 46.261638], - [19.227967, 46.269796], - [19.241574, 46.28155], - [19.261103, 46.269796], - [19.241574, 46.261638] - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "stroke-width": 4, - "fill-opacity": 0.4, - "stroke": "blue", - "fill": "blue", - "pressure": 0.5 - }, - "geometry": { - "type": "MultiLineString", - "coordinates": [ - [ - [6.638495, 48.924741], - [6.5, 48.911051] + [19.245592, 46.539592], + [19.241574, 46.505856], + [19.212444, 46.539592], + [19.241574, 46.551269], + [19.245592, 46.539592] ], [ - [6.5, 49.476205], - [6.547975, 49.507349] + [17.036451, 46.719456], + [17.066899, 46.629524], + [17.025648, 46.593742], + [16.887153, 46.576391], + [16.806188, 46.629524], + [16.837829, 46.719456], + [16.887153, 46.739855], + [17.025648, 46.72559], + [17.036451, 46.719456] ], [ - [6.776991, 48.955575], - [6.638495, 48.924741] + [19.242707, 46.719456], + [19.241574, 46.712954], + [19.230795, 46.719456], + [19.241574, 46.720647], + [19.242707, 46.719456] ], [ - [6.915486, 47.583233], - [6.904869, 47.618777], - [6.898708, 47.708709], - [6.915094, 47.798641], - [6.915486, 47.799543], - [6.953518, 47.888573], - [7.024108, 47.978505], - [7.053981, 48.005076], - [7.140225, 48.068437], - [7.192477, 48.097719], - [7.330972, 48.150124], - [7.372032, 48.158369], - [7.469468, 48.177716], - [7.607963, 48.182831], - [7.746458, 48.162429], [7.757103, 48.158369], [7.884954, 48.114893], [7.944769, 48.068437], @@ -359,384 +442,122 @@ [7.04482, 47.348981], [6.977129, 47.438913], [6.931048, 47.528845], - [6.915486, 47.583233] - ], - [ - [6.811596, 48.967757], - [6.776991, 48.955575] - ], - [ - [6.915486, 49.00276], - [6.811596, 48.967757] + [6.915486, 47.583233], + [6.904869, 47.618777], + [6.898708, 47.708709], + [6.915094, 47.798641], + [6.915486, 47.799543], + [6.953518, 47.888573], + [7.024108, 47.978505], + [7.053981, 48.005076], + [7.140225, 48.068437], + [7.192477, 48.097719], + [7.330972, 48.150124], + [7.372032, 48.158369], + [7.469468, 48.177716], + [7.607963, 48.182831], + [7.746458, 48.162429], + [7.757103, 48.158369] ], [ - [7.021939, 49.057689], - [6.915486, 49.00276] + [15.640953, 47.348981], + [15.77919, 47.289836], + [15.829116, 47.259049], + [15.915177, 47.169116], + [15.885133, 47.079184], + [15.77919, 47.01095], + [15.640694, 46.99557], + [15.502199, 47.014524], + [15.363703, 47.051232], + [15.301081, 47.079184], + [15.225208, 47.140803], + [15.175394, 47.169116], + [15.128914, 47.259049], + [15.225208, 47.29727], + [15.286403, 47.348981], + [15.363703, 47.372228], + [15.502199, 47.382661], + [15.640694, 47.349087], + [15.640953, 47.348981] ], [ - [7.053981, 49.07576], - [7.021939, 49.057689] + [14.944964, 47.438913], + [14.948217, 47.43651], + [15.049066, 47.348981], + [15.070376, 47.259049], + [14.981512, 47.169116], + [14.948217, 47.157858], + [14.809722, 47.110822], + [14.671227, 47.108275], + [14.532731, 47.151788], + [14.505265, 47.169116], + [14.428535, 47.259049], + [14.428693, 47.348981], + [14.505161, 47.438913], + [14.532731, 47.45479], + [14.671227, 47.497036], + [14.809722, 47.491608], + [14.944964, 47.438913] ], [ - [7.150894, 49.147621], - [7.053981, 49.07576] + [16.753843, 47.618777], + [16.748657, 47.61171], + [16.610162, 47.576856], + [16.55221, 47.618777], + [16.610162, 47.693084], + [16.748657, 47.632192], + [16.753843, 47.618777] ], [ - [7.192477, 49.187048], - [7.150894, 49.147621] - ], - [ - [7.23853, 49.237553], - [7.192477, 49.187048] - ], - [ - [7.296208, 49.327485], - [7.23853, 49.237553] - ], - [ - [7.329322, 49.417417], - [7.296208, 49.327485] - ], - [ - [7.330972, 49.429189], - [7.329322, 49.417417] - ], - [ - [7.342413, 49.507349], - [7.330972, 49.429189] - ], - [ - [12.039815, 46.810095], - [11.968106, 46.89932], - [11.950779, 46.989252], - [11.986492, 47.079184], - [12.039815, 47.132358], - [12.085344, 47.169116], - [12.17831, 47.258912], - [12.178407, 47.259049], - [12.228722, 47.348981], - [12.286307, 47.438913], - [12.227878, 47.528845], - [12.316805, 47.550894], - [12.409847, 47.528845], - [12.455301, 47.439296], - [12.456106, 47.438913], - [12.593796, 47.396831], - [12.681485, 47.348981], - [12.723597, 47.259049], - [12.726633, 47.169116], - [12.732292, 47.136674], - [12.746385, 47.079184], - [12.792784, 46.989252], - [12.870787, 46.917991], - [13.009282, 46.903932], - [13.147778, 46.899728], - [13.151005, 46.89932], - [13.286273, 46.885734], - [13.424768, 46.851978], - [13.525358, 46.809388], - [13.563264, 46.789296], - [13.664117, 46.719456], - [13.701759, 46.68041], - [13.749338, 46.629524], - [13.804668, 46.539592], - [13.838909, 46.44966], - [13.840254, 46.442365], - [13.858366, 46.359728], - [13.858124, 46.269796], - [13.840254, 46.206993], - [13.833446, 46.179864], - [13.782815, 46.089932], - [13.701759, 46.015819], - [13.682327, 46] - ], - [ - [12.17831, 46.726561], - [12.040741, 46.809388], - [12.039815, 46.810095] - ], - [ - [12.316805, 46.66745], - [12.206125, 46.719456], - [12.17831, 46.726561] - ], - [ - [12.455301, 46.327499], - [12.446405, 46.359728], - [12.435651, 46.44966], - [12.429156, 46.539592], - [12.394556, 46.629524], - [12.316805, 46.66745] - ], - [ - [12.593796, 46.075577], - [12.578669, 46.089932], - [12.510938, 46.179864], - [12.469615, 46.269796], - [12.455301, 46.327499] - ], - [ - [12.593796, 48.030327], - [12.551601, 48.068437], - [12.561575, 48.158369], - [12.593796, 48.193019], - [12.732292, 48.232741], - [12.870787, 48.197294], [12.920539, 48.158369], [12.941498, 48.068437], [12.870787, 48.007987], [12.789645, 47.978505], [12.732292, 47.971499], [12.707656, 47.978505], - [12.593796, 48.030327] - ], - [ - [12.683417, 46], - [12.593796, 46.075577] - ], - [ - [14.369931, 46], - [14.394236, 46.040341], - [14.418486, 46.089932], - [14.532731, 46.170845], - [14.552367, 46.179864], - [14.671227, 46.22058], - [14.809722, 46.23732], - [14.948217, 46.232071], - [15.086713, 46.218284], - [15.225208, 46.226715], - [15.363703, 46.263342], - [15.380442, 46.269796], - [15.502199, 46.304995], - [15.640694, 46.338291], - [15.77919, 46.349711], - [15.917685, 46.330436], - [16.049628, 46.269796], - [16.05618, 46.26467], - [16.128158, 46.179864], - [16.150722, 46.089932], - [16.136546, 46] - ], - [ - [14.532731, 47.151788], - [14.505265, 47.169116], - [14.428535, 47.259049], - [14.428693, 47.348981], - [14.505161, 47.438913], - [14.532731, 47.45479], - [14.671227, 47.497036], - [14.809722, 47.491608], - [14.944964, 47.438913], - [14.948217, 47.43651], - [15.049066, 47.348981], - [15.070376, 47.259049], - [14.981512, 47.169116], - [14.948217, 47.157858], - [14.809722, 47.110822], - [14.671227, 47.108275], - [14.532731, 47.151788] - ], - [ - [15.225208, 47.140803], - [15.175394, 47.169116], - [15.128914, 47.259049], - [15.225208, 47.29727], - [15.286403, 47.348981], - [15.363703, 47.372228], - [15.502199, 47.382661], - [15.640694, 47.349087], - [15.640953, 47.348981], - [15.77919, 47.289836], - [15.829116, 47.259049], - [15.915177, 47.169116], - [15.885133, 47.079184], - [15.77919, 47.01095], - [15.640694, 46.99557], - [15.502199, 47.014524], - [15.363703, 47.051232], - [15.301081, 47.079184], - [15.225208, 47.140803] - ], - [ - [16.610162, 47.576856], - [16.55221, 47.618777], - [16.610162, 47.693084], - [16.748657, 47.632192], - [16.753843, 47.618777], - [16.748657, 47.61171], - [16.610162, 47.576856] - ], - [ - [16.887153, 46.576391], - [16.806188, 46.629524], - [16.837829, 46.719456], - [16.887153, 46.739855], - [17.025648, 46.72559], - [17.036451, 46.719456], - [17.066899, 46.629524], - [17.025648, 46.593742], - [16.887153, 46.576391] - ], - [ - [17.441134, 46.474778], - [17.347844, 46.539592], - [17.441134, 46.595224], - [17.53461, 46.539592], - [17.441134, 46.474778] - ], - [ - [18.272106, 46.524045], - [18.264737, 46.539592], - [18.272106, 46.553925], - [18.342339, 46.539592], - [18.272106, 46.524045] - ], - [ - [19.241574, 46.240533], - [19.192764, 46.269796], - [19.241574, 46.311959], - [19.311629, 46.269796], - [19.241574, 46.240533] - ], - [ - [19.241574, 46.505856], - [19.212444, 46.539592], - [19.241574, 46.551269], - [19.245592, 46.539592], - [19.241574, 46.505856] - ], - [ - [19.241574, 46.712954], - [19.230795, 46.719456], - [19.241574, 46.720647], - [19.242707, 46.719456], - [19.241574, 46.712954] - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "stroke-width": 4, - "fill-opacity": 0.4, - "stroke": "green", - "fill": "green", - "pressure": 1.5 - }, - "geometry": { - "type": "MultiLineString", - "coordinates": [ - [ - [8.980847, 46.179864], - [8.992917, 46.149581], - [9.023838, 46.089932], - [9.076637, 46] - ], - [ - [8.947567, 46.269796], - [8.980847, 46.179864] - ], - [ - [8.923286, 46.359728], - [8.947567, 46.269796] - ], - [ - [8.908239, 46.44966], - [8.923286, 46.359728] - ], - [ - [8.902529, 46.539592], - [8.908239, 46.44966] - ], - [ - [8.906369, 46.629524], - [8.902529, 46.539592] - ], - [ - [8.920539, 46.719456], - [8.906369, 46.629524] - ], - [ - [8.947278, 46.809388], - [8.920539, 46.719456] - ], - [ - [8.992196, 46.89932], - [8.947278, 46.809388] - ], - [ - [8.992917, 46.900185], - [8.992196, 46.89932] - ], - [ - [9.045901, 46.989252], - [8.992917, 46.900185] - ], - [ - [9.131412, 47.073855], - [9.045901, 46.989252] - ], - [ - [9.13541, 47.079184], - [9.131412, 47.073855] - ], - [ - [9.246341, 47.169116], - [9.13541, 47.079184] - ], - [ - [9.269907, 47.182985], - [9.246341, 47.169116] - ], - [ - [9.388374, 47.259049], - [9.269907, 47.182985] - ], - [ - [9.408403, 47.271404], - [9.388374, 47.259049] - ], - [ - [9.546898, 47.345925], - [9.408403, 47.271404] - ], - [ - [9.55524, 47.348981], - [9.546898, 47.345925] - ], - [ - [9.685393, 47.413084], - [9.55524, 47.348981] - ], - [ - [9.769285, 47.438913], - [9.685393, 47.413084] - ], - [ - [9.823889, 47.464844], - [9.769285, 47.438913] - ], - [ - [9.962384, 47.506672], - [9.823889, 47.464844] - ], - [ - [10.072761, 47.528845], - [9.962384, 47.506672] - ], - [ - [10.10088, 47.538375], - [10.072761, 47.528845] + [12.593796, 48.030327], + [12.551601, 48.068437], + [12.561575, 48.158369], + [12.593796, 48.193019], + [12.732292, 48.232741], + [12.870787, 48.197294], + [12.920539, 48.158369] ], [ - [10.239375, 47.56654], - [10.10088, 47.538375] + [7.342413, 49.507349], + [7.330972, 49.429189], + [7.329322, 49.417417], + [7.296208, 49.327485], + [7.23853, 49.237553], + [7.192477, 49.187048], + [7.150894, 49.147621], + [7.053981, 49.07576], + [7.021939, 49.057689], + [6.915486, 49.00276], + [6.811596, 48.967757], + [6.776991, 48.955575], + [6.638495, 48.924741], + [6.5, 48.911051] ], [ - [10.37787, 47.586162], - [10.239375, 47.56654] - ], + [6.5, 49.476205], + [6.547975, 49.507349] + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "stroke-width": 4, + "fill-opacity": 0.4, + "stroke": "green", + "fill": "green", + "pressure": 1.5 + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [ [ [10.290136, 49.507349], [10.37787, 49.417436], @@ -767,7 +588,36 @@ [10.664976, 47.618777], [10.654861, 47.617167], [10.516366, 47.600939], - [10.37787, 47.586162] + [10.37787, 47.586162], + [10.239375, 47.56654], + [10.10088, 47.538375], + [10.072761, 47.528845], + [9.962384, 47.506672], + [9.823889, 47.464844], + [9.769285, 47.438913], + [9.685393, 47.413084], + [9.55524, 47.348981], + [9.546898, 47.345925], + [9.408403, 47.271404], + [9.388374, 47.259049], + [9.269907, 47.182985], + [9.246341, 47.169116], + [9.13541, 47.079184], + [9.131412, 47.073855], + [9.045901, 46.989252], + [8.992917, 46.900185], + [8.992196, 46.89932], + [8.947278, 46.809388], + [8.920539, 46.719456], + [8.906369, 46.629524], + [8.902529, 46.539592], + [8.908239, 46.44966], + [8.923286, 46.359728], + [8.947567, 46.269796], + [8.980847, 46.179864], + [8.992917, 46.149581], + [9.023838, 46.089932], + [9.076637, 46] ], [ [10.407143, 46], @@ -910,39 +760,6 @@ [16.592577, 46] ], [ - [16.471666, 47.523183], - [16.459871, 47.528845], - [16.39275, 47.618777], - [16.423799, 47.708709], - [16.471666, 47.739752], - [16.610162, 47.780929], - [16.748657, 47.750989], - [16.795822, 47.708709], - [16.825353, 47.618777], - [16.760528, 47.528845], - [16.748657, 47.518876], - [16.610162, 47.486471], - [16.471666, 47.523183] - ], - [ - [18.272106, 46.466439], - [18.237432, 46.539592], - [18.272106, 46.607031], - [18.410602, 46.606569], - [18.486898, 46.539592], - [18.410602, 46.458147], - [18.272106, 46.466439] - ], - [ - [19.103078, 46.183635], - [19.03808, 46.269796], - [19.0463, 46.359728], - [18.997368, 46.44966], - [18.997661, 46.539592], - [19.031576, 46.629524], - [19.043162, 46.719456], - [19.103078, 46.752041], - [19.241574, 46.756326], [19.276687, 46.719456], [19.270089, 46.629524], [19.308501, 46.539592], @@ -954,7 +771,40 @@ [19.290855, 46.179864], [19.241574, 46.143947], [19.110731, 46.179864], - [19.103078, 46.183635] + [19.103078, 46.183635], + [19.03808, 46.269796], + [19.0463, 46.359728], + [18.997368, 46.44966], + [18.997661, 46.539592], + [19.031576, 46.629524], + [19.043162, 46.719456], + [19.103078, 46.752041], + [19.241574, 46.756326], + [19.276687, 46.719456] + ], + [ + [18.486898, 46.539592], + [18.410602, 46.458147], + [18.272106, 46.466439], + [18.237432, 46.539592], + [18.272106, 46.607031], + [18.410602, 46.606569], + [18.486898, 46.539592] + ], + [ + [16.795822, 47.708709], + [16.825353, 47.618777], + [16.760528, 47.528845], + [16.748657, 47.518876], + [16.610162, 47.486471], + [16.471666, 47.523183], + [16.459871, 47.528845], + [16.39275, 47.618777], + [16.423799, 47.708709], + [16.471666, 47.739752], + [16.610162, 47.780929], + [16.748657, 47.750989], + [16.795822, 47.708709] ] ] } @@ -971,62 +821,6 @@ "geometry": { "type": "MultiLineString", "coordinates": [ - [ - [9.337463, 46.809388], - [9.408403, 46.722835], - [9.412794, 46.719456], - [9.546898, 46.641769], - [9.598208, 46.629524], - [9.685393, 46.606681], - [9.823889, 46.60198], - [9.962384, 46.626776], - [9.969751, 46.629524], - [10.10088, 46.681361], - [10.157625, 46.719456], - [10.239375, 46.80073], - [10.246587, 46.809388], - [10.291062, 46.89932], - [10.297274, 46.989252], - [10.264072, 47.079184], - [10.239375, 47.107527], - [10.181396, 47.169116], - [10.10088, 47.214757], - [9.962384, 47.256597], - [9.928408, 47.259049], - [9.823889, 47.265833], - [9.781217, 47.259049], - [9.685393, 47.247314], - [9.546898, 47.20002], - [9.491862, 47.169116], - [9.408403, 47.10523], - [9.377816, 47.079184], - [9.322633, 46.989252], - [9.310428, 46.89932], - [9.337463, 46.809388] - ], - [ - [11.841028, 47.798641], - [11.901319, 47.714874], - [11.904159, 47.708709], - [12.039815, 47.646328], - [12.17831, 47.628932], - [12.316805, 47.62992], - [12.455301, 47.631881], - [12.593796, 47.671104], - [12.655704, 47.708709], - [12.648396, 47.798641], - [12.593796, 47.833834], - [12.522784, 47.888573], - [12.455301, 47.924652], - [12.316805, 47.976579], - [12.300928, 47.978505], - [12.17831, 48.008742], - [12.039815, 47.999507], - [11.979483, 47.978505], - [11.901319, 47.928979], - [11.860265, 47.888573], - [11.841028, 47.798641] - ], [ [14.186388, 49.507349], [14.255741, 49.418794], @@ -1106,21 +900,9 @@ [17.228682, 46] ], [ - [18.272106, 46.391555], - [18.233988, 46.44966], - [18.210127, 46.539592], - [18.240845, 46.629524], - [18.272106, 46.663224], - [18.410602, 46.675969], - [18.538193, 46.629524], - [18.549097, 46.617108], - [18.652106, 46.539592], - [18.657319, 46.44966], - [18.549097, 46.390896], - [18.410602, 46.36377], - [18.272106, 46.391555] - ], - [ + [19.006245, 46], + [18.964583, 46.020322], + [18.876486, 46.089932], [18.826088, 46.163575], [18.814561, 46.179864], [18.775267, 46.269796], @@ -1146,13 +928,75 @@ [19.524275, 46] ], [ - [18.964583, 46.020322], - [18.876486, 46.089932], - [18.826088, 46.163575] + [18.538193, 46.629524], + [18.549097, 46.617108], + [18.652106, 46.539592], + [18.657319, 46.44966], + [18.549097, 46.390896], + [18.410602, 46.36377], + [18.272106, 46.391555], + [18.233988, 46.44966], + [18.210127, 46.539592], + [18.240845, 46.629524], + [18.272106, 46.663224], + [18.410602, 46.675969], + [18.538193, 46.629524] ], [ - [19.006245, 46], - [18.964583, 46.020322] + [9.823889, 47.265833], + [9.781217, 47.259049], + [9.685393, 47.247314], + [9.546898, 47.20002], + [9.491862, 47.169116], + [9.408403, 47.10523], + [9.377816, 47.079184], + [9.322633, 46.989252], + [9.310428, 46.89932], + [9.337463, 46.809388], + [9.408403, 46.722835], + [9.412794, 46.719456], + [9.546898, 46.641769], + [9.598208, 46.629524], + [9.685393, 46.606681], + [9.823889, 46.60198], + [9.962384, 46.626776], + [9.969751, 46.629524], + [10.10088, 46.681361], + [10.157625, 46.719456], + [10.239375, 46.80073], + [10.246587, 46.809388], + [10.291062, 46.89932], + [10.297274, 46.989252], + [10.264072, 47.079184], + [10.239375, 47.107527], + [10.181396, 47.169116], + [10.10088, 47.214757], + [9.962384, 47.256597], + [9.928408, 47.259049], + [9.823889, 47.265833] + ], + [ + [12.17831, 48.008742], + [12.039815, 47.999507], + [11.979483, 47.978505], + [11.901319, 47.928979], + [11.860265, 47.888573], + [11.841028, 47.798641], + [11.901319, 47.714874], + [11.904159, 47.708709], + [12.039815, 47.646328], + [12.17831, 47.628932], + [12.316805, 47.62992], + [12.455301, 47.631881], + [12.593796, 47.671104], + [12.655704, 47.708709], + [12.648396, 47.798641], + [12.593796, 47.833834], + [12.522784, 47.888573], + [12.455301, 47.924652], + [12.316805, 47.976579], + [12.300928, 47.978505], + [12.17831, 48.008742] ] ] } @@ -1166,7 +1010,10 @@ "fill": "red", "pressure": 100 }, - "geometry": { "type": "MultiLineString", "coordinates": [] } + "geometry": { + "type": "MultiLineString", + "coordinates": [] + } }, { "type": "Feature", diff --git a/packages/turf-isolines/test/out/matrix1.geojson b/packages/turf-isolines/test/out/matrix1.geojson index b67dfba6ac..8ff652ed6e 100644 --- a/packages/turf-isolines/test/out/matrix1.geojson +++ b/packages/turf-isolines/test/out/matrix1.geojson @@ -3,11 +3,21 @@ "features": [ { "type": "Feature", - "properties": { "temperature": 2 }, + "properties": { + "temperature": 2 + }, "geometry": { "type": "MultiLineString", "coordinates": [ [ + [12.071816, 44.954354], + [11.817453, 44.954354], + [11.56309, 44.954354], + [11.308726, 44.954354], + [11.054363, 44.954354], + [10.863591, 44.819456], + [10.863591, 44.639592], + [10.863591, 44.459728], [10.863591, 44.279864], [11.054363, 44.144966], [11.308726, 44.144966], @@ -18,26 +28,28 @@ [12.262588, 44.459728], [12.262588, 44.639592], [12.262588, 44.819456], - [12.071816, 44.954354], - [11.817453, 44.954354], - [11.56309, 44.954354], - [11.308726, 44.954354], - [11.054363, 44.954354], - [10.863591, 44.819456], - [10.863591, 44.639592], - [10.863591, 44.459728], - [10.863591, 44.279864] + [12.071816, 44.954354] ] ] } }, { "type": "Feature", - "properties": { "temperature": 4 }, + "properties": { + "temperature": 4 + }, "geometry": { "type": "MultiLineString", "coordinates": [ [ + [12.071816, 44.864422], + [11.817453, 44.864422], + [11.56309, 44.864422], + [11.308726, 44.864422], + [11.054363, 44.864422], + [10.990772, 44.819456], + [10.990772, 44.639592], + [10.990772, 44.459728], [10.990772, 44.279864], [11.054363, 44.234898], [11.308726, 44.234898], @@ -48,57 +60,53 @@ [12.135407, 44.459728], [12.135407, 44.639592], [12.135407, 44.819456], - [12.071816, 44.864422], - [11.817453, 44.864422], - [11.56309, 44.864422], - [11.308726, 44.864422], - [11.054363, 44.864422], - [10.990772, 44.819456], - [10.990772, 44.639592], - [10.990772, 44.459728], - [10.990772, 44.279864] + [12.071816, 44.864422] ] ] } }, { "type": "Feature", - "properties": { "temperature": 8 }, + "properties": { + "temperature": 8 + }, "geometry": { "type": "MultiLineString", "coordinates": [ [ + [11.817453, 44.765497], + [11.56309, 44.765497], + [11.308726, 44.765497], + [11.130672, 44.639592], [11.206981, 44.459728], [11.308726, 44.387783], [11.56309, 44.387783], [11.817453, 44.387783], [11.919198, 44.459728], [11.995507, 44.639592], - [11.817453, 44.765497], - [11.56309, 44.765497], - [11.308726, 44.765497], - [11.130672, 44.639592], - [11.206981, 44.459728] + [11.817453, 44.765497] ] ] } }, { "type": "Feature", - "properties": { "temperature": 12 }, + "properties": { + "temperature": 12 + }, "geometry": { "type": "MultiLineString", "coordinates": [ [ + [11.817453, 44.693551], + [11.56309, 44.693551], + [11.308726, 44.693551], [11.232417, 44.639592], [11.308726, 44.531674], [11.56309, 44.531674], [11.817453, 44.531674], [11.893762, 44.639592], - [11.817453, 44.693551], - [11.56309, 44.693551], - [11.308726, 44.693551], - [11.232417, 44.639592] + [11.817453, 44.693551] ] ] } diff --git a/packages/turf-isolines/test/out/matrix2.geojson b/packages/turf-isolines/test/out/matrix2.geojson index 6e09eb3644..ee6c9e0b03 100644 --- a/packages/turf-isolines/test/out/matrix2.geojson +++ b/packages/turf-isolines/test/out/matrix2.geojson @@ -14,14 +14,6 @@ "type": "MultiLineString", "coordinates": [ [ - [11.106337, 44.629524], - [11.080704, 44.719456], - [11.106337, 44.809388], - [11.14906, 44.89932], - [11.14906, 45.079184], - [11.362675, 45.229071], - [11.490843, 45.259049], - [11.619012, 45.277035], [11.747181, 45.259049], [11.87535, 45.229071], [12.088964, 45.079184], @@ -38,14 +30,22 @@ [11.362675, 44.209841], [11.14906, 44.359728], [11.14906, 44.539592], - [11.106337, 44.629524] + [11.106337, 44.629524], + [11.080704, 44.719456], + [11.106337, 44.809388], + [11.14906, 44.89932], + [11.14906, 45.079184], + [11.362675, 45.229071], + [11.490843, 45.259049], + [11.619012, 45.277035], + [11.747181, 45.259049] ], [ + [11.619012, 44.842091], [11.444237, 44.719456], [11.619012, 44.596822], [11.793788, 44.719456], - [11.619012, 44.842091], - [11.444237, 44.719456] + [11.619012, 44.842091] ] ] } @@ -63,6 +63,17 @@ "type": "MultiLineString", "coordinates": [ [ + [12.182954, 45.259049], + [12.336757, 45.079184], + [12.336757, 44.89932], + [12.388024, 44.719456], + [12.336757, 44.539592], + [12.336757, 44.359728], + [12.182954, 44.179864], + [12.131687, 44.143891], + [11.87535, 44.035973], + [11.619012, 44], + [11.362675, 44.035973], [11.106337, 44.143891], [11.05507, 44.179864], [10.901267, 44.359728], @@ -76,25 +87,14 @@ [11.619012, 45.438913], [11.87535, 45.40294], [12.131687, 45.295021], - [12.182954, 45.259049], - [12.336757, 45.079184], - [12.336757, 44.89932], - [12.388024, 44.719456], - [12.336757, 44.539592], - [12.336757, 44.359728], - [12.182954, 44.179864], - [12.131687, 44.143891], - [11.87535, 44.035973], - [11.619012, 44], - [11.362675, 44.035973], - [11.106337, 44.143891] + [12.182954, 45.259049] ], [ + [11.619012, 44.76851], [11.549102, 44.719456], [11.619012, 44.670402], [11.688922, 44.719456], - [11.619012, 44.76851], - [11.549102, 44.719456] + [11.619012, 44.76851] ] ] } @@ -115,14 +115,14 @@ [11.080704, 44], [10.85, 44.161878] ], - [ - [10.85, 45.277035], - [11.080704, 45.438913] - ], [ [12.388024, 44.161878], [12.157321, 44] ], + [ + [10.85, 45.277035], + [11.080704, 45.438913] + ], [ [12.157321, 45.438913], [12.388024, 45.277035] @@ -146,14 +146,14 @@ [10.85, 44], [10.85, 44] ], - [ - [10.85, 45.438913], - [10.85, 45.438913] - ], [ [12.388024, 44], [12.388024, 44] ], + [ + [10.85, 45.438913], + [10.85, 45.438913] + ], [ [12.388024, 45.438913], [12.388024, 45.438913] diff --git a/packages/turf-isolines/test/out/pointGrid.geojson b/packages/turf-isolines/test/out/pointGrid.geojson index 24faca3dcd..34f70dd92c 100644 --- a/packages/turf-isolines/test/out/pointGrid.geojson +++ b/packages/turf-isolines/test/out/pointGrid.geojson @@ -3,7 +3,10 @@ "features": [ { "type": "Feature", - "properties": { "fill-opacity": 0.5, "population": 20 }, + "properties": { + "fill-opacity": 0.5, + "population": 20 + }, "geometry": { "type": "MultiLineString", "coordinates": [ @@ -25,8 +28,9 @@ [-70.645198, -33.553984] ], [ - [-70.769424, -33.443779], - [-70.823364, -33.429795] + [-70.671006, -33.553984], + [-70.715483, -33.518772], + [-70.764237, -33.553984] ], [ [-70.823364, -33.406542], @@ -34,36 +38,26 @@ [-70.769424, -33.351019], [-70.742454, -33.374176], [-70.731216, -33.419128], - [-70.769424, -33.443779] - ], - [ - [-70.715483, -33.518772], - [-70.764237, -33.553984] - ], - [ - [-70.671006, -33.553984], - [-70.715483, -33.518772] - ], - [ - [-70.607603, -33.337216], - [-70.629732, -33.329224] - ], - [ - [-70.553662, -33.335329], - [-70.607603, -33.337216] + [-70.769424, -33.443779], + [-70.823364, -33.429795] ], [ [-70.499722, -33.442285], [-70.514512, -33.419128], [-70.511237, -33.374176], - [-70.553662, -33.335329] + [-70.553662, -33.335329], + [-70.607603, -33.337216], + [-70.629732, -33.329224] ] ] } }, { "type": "Feature", - "properties": { "fill-opacity": 0.6, "population": 40 }, + "properties": { + "fill-opacity": 0.6, + "population": 40 + }, "geometry": { "type": "MultiLineString", "coordinates": [ @@ -74,14 +68,21 @@ [-70.823364, -33.445033] ], [ - [-70.823364, -33.388561], - [-70.80708, -33.374176], - [-70.771237, -33.329224] - ], - [ + [-70.689933, -33.553984], [-70.715483, -33.533756], [-70.743491, -33.553984] ], + [ + [-70.499722, -33.468361], + [-70.527801, -33.509032], + [-70.553662, -33.539288], + [-70.607603, -33.54859], + [-70.612506, -33.553984] + ], + [ + [-70.515455, -33.553984], + [-70.499722, -33.546991] + ], [ [-70.764287, -33.329224], [-70.715483, -33.370887], @@ -99,43 +100,26 @@ [-70.657394, -33.329224] ], [ - [-70.689933, -33.553984], - [-70.715483, -33.533756] - ], - [ - [-70.607603, -33.54859], - [-70.612506, -33.553984] - ], - [ - [-70.553662, -33.539288], - [-70.607603, -33.54859] - ], - [ - [-70.515455, -33.553984], - [-70.499722, -33.546991] - ], - [ - [-70.527801, -33.509032], - [-70.553662, -33.539288] - ], - [ - [-70.499722, -33.468361], - [-70.527801, -33.509032] + [-70.823364, -33.388561], + [-70.80708, -33.374176], + [-70.771237, -33.329224] ] ] } }, { "type": "Feature", - "properties": { "fill-opacity": 0.7, "population": 80 }, + "properties": { + "fill-opacity": 0.7, + "population": 80 + }, "geometry": { "type": "MultiLineString", "coordinates": [ [ - [-70.823364, -33.363279], - [-70.789368, -33.329224] - ], - [ + [-70.553662, -33.368626], + [-70.607603, -33.367184], + [-70.661543, -33.369791], [-70.666134, -33.374176], [-70.661543, -33.379976], [-70.626021, -33.419128], @@ -143,18 +127,25 @@ [-70.581563, -33.419128], [-70.553662, -33.392157], [-70.547602, -33.374176], - [-70.553662, -33.368626], - [-70.607603, -33.367184], - [-70.661543, -33.369791], - [-70.666134, -33.374176] + [-70.553662, -33.368626] + ], + [ + [-70.823364, -33.363279], + [-70.789368, -33.329224] ] ] } }, { "type": "Feature", - "properties": { "fill-opacity": 0.8, "population": 160 }, - "geometry": { "type": "MultiLineString", "coordinates": [] } + "properties": { + "fill-opacity": 0.8, + "population": 160 + }, + "geometry": { + "type": "MultiLineString", + "coordinates": [] + } }, { "type": "Feature", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e4d8df702c..1a4bd7a1ed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3576,9 +3576,6 @@ importers: '@types/geojson': specifier: ^7946.0.10 version: 7946.0.14 - marchingsquares: - specifier: ^1.3.3 - version: 1.3.3 tslib: specifier: ^2.8.1 version: 2.8.1