Skip to content

Commit

Permalink
Add Circle to test debug
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Sep 16, 2017
1 parent c04ccd5 commit 162b94d
Show file tree
Hide file tree
Showing 9 changed files with 1,699 additions and 1,136 deletions.
1 change: 1 addition & 0 deletions packages/turf-nearest-point-to-line/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"homepage": "https://github.com/Turfjs/turf",
"devDependencies": {
"@turf/circle": "^4.7.3",
"@turf/helpers": "4.7.1",
"benchmark": "^2.1.4",
"load-json-file": "^2.0.0",
Expand Down
7 changes: 5 additions & 2 deletions packages/turf-nearest-point-to-line/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const test = require('tape');
const path = require('path');
const load = require('load-json-file');
const write = require('write-json-file');
const circle = require('@turf/circle');
const {geometryCollection, featureCollection, point, lineString, round} = require('@turf/helpers');
const nearestPointToLine = require('./');

Expand All @@ -24,13 +25,15 @@ test('turf-nearest-point-to-line', t => {
const [points, line] = geojson.features;
let {units} = geojson.properties || {};
const nearest = nearestPointToLine(points, line, units);
nearest.properties.dist = round(nearest.properties.dist, 13);
const distance = round(nearest.properties.dist, 13);
nearest.properties.dist = distance;
nearest.properties = Object.assign(nearest.properties, {
'marker-color': '#F00',
'marker-size': 'large',
'marker-symbol': 'star'
});
const results = featureCollection([points, nearest, line]);
const distanceCircle = circle(nearest, distance || 1, null, units, {fill: '#F00'});
const results = featureCollection([points, nearest, line, distanceCircle]);

if (process.env.REGEN) write.sync(directories.out + filename, results);
t.deepEqual(results, load.sync(directories.out + filename), name);
Expand Down
273 changes: 273 additions & 0 deletions packages/turf-nearest-point-to-line/test/out/fiji.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,279 @@
]
]
}
},
{
"type": "Feature",
"properties": {
"fill": "#F00"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
180.25817871093747,
-16.92283728273034
],
[
180.26140745517685,
-16.922989006748615
],
[
180.2646051203381,
-16.923442718347573
],
[
180.26774092605737,
-16.924194050196636
],
[
180.27078468654537,
-16.925235770067523
],
[
180.27370710076607,
-16.926557850350097
],
[
180.27648003415976,
-16.928147564442767
],
[
180.27907678921423,
-16.929989609096015
],
[
180.28147236229424,
-16.932066251539226
],
[
180.28364368426517,
-16.934357499983644
],
[
180.28556984260155,
-16.93684129586978
],
[
180.28723228284287,
-16.93949372601873
],
[
180.2886149874553,
-16.942289252655215
],
[
180.28970463036944,
-16.945200959097615
],
[
180.29049070569587,
-16.948200808758514
],
[
180.2909656293636,
-16.951259914970034
],
[
180.2911248126863,
-16.954348819042398
],
[
180.29096670712613,
-16.957437773883147
],
[
180.29049281980318,
-16.960497030448806
],
[
180.2897076995777,
-16.963497124271584
],
[
180.28861889381645,
-16.966409159300607
],
[
180.28723687623776,
-16.969205086321065
],
[
180.28557494650863,
-16.97185797326481
],
[
180.28364910254425,
-16.974342264802207
],
[
180.28147788672385,
-16.97663402870676
],
[
180.27908220749367,
-16.978711186610127
],
[
180.27648513806756,
-16.980553726914707
],
[
180.2737116941619,
-16.982143897802292
],
[
180.27078859290754,
-16.98346637846897
],
[
180.2677439952665,
-16.984508426926606
],
[
180.26460723444615,
-16.98526000293766
],
[
180.2614085329398,
-16.985713864890837
],
[
180.25817871093747,
-16.98586563967752
],
[
180.25494888893516,
-16.985713864890837
],
[
180.25175018742883,
-16.98526000293766
],
[
180.24861342660847,
-16.984508426926606
],
[
180.24556882896744,
-16.98346637846897
],
[
180.24264572771307,
-16.982143897802292
],
[
180.23987228380741,
-16.980553726914707
],
[
180.2372752143813,
-16.978711186610127
],
[
180.23487953515112,
-16.97663402870676
],
[
180.23270831933073,
-16.974342264802207
],
[
180.23078247536634,
-16.97185797326481
],
[
180.2291205456372,
-16.969205086321065
],
[
180.2277385280585,
-16.966409159300607
],
[
180.22664972229728,
-16.963497124271584
],
[
180.2258646020718,
-16.960497030448806
],
[
180.22539071474884,
-16.957437773883147
],
[
180.22523260918868,
-16.954348819042398
],
[
180.22539179251137,
-16.951259914970034
],
[
180.2258667161791,
-16.948200808758514
],
[
180.2266527915055,
-16.945200959097615
],
[
180.22774243441967,
-16.942289252655215
],
[
180.2291251390321,
-16.93949372601873
],
[
180.23078757927343,
-16.93684129586978
],
[
180.2327137376098,
-16.934357499983644
],
[
180.23488505958073,
-16.932066251539226
],
[
180.23728063266074,
-16.929989609096015
],
[
180.2398773877152,
-16.928147564442767
],
[
180.24265032110887,
-16.926557850350097
],
[
180.2455727353296,
-16.925235770067523
],
[
180.2486164958176,
-16.924194050196636
],
[
180.25175230153687,
-16.923442718347573
],
[
180.2549499666981,
-16.922989006748615
],
[
180.25817871093747,
-16.92283728273034
]
]
]
}
}
]
}
Loading

0 comments on commit 162b94d

Please sign in to comment.