Skip to content

Commit

Permalink
Fix turf-along using raw geometry (#376)
Browse files Browse the repository at this point in the history
* coordinate array from raw geometry should pull line.coordinates rather than line.geometry.coordinates

* update test suite to test raw geometry checks
  • Loading branch information
jvrousseau authored and tmcw committed May 17, 2016
1 parent 7a244f6 commit f856628
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/turf-along/index.js
Expand Up @@ -41,7 +41,7 @@ var destination = require('turf-destination');
module.exports = function (line, dist, units) {
var coords;
if (line.type === 'Feature') coords = line.geometry.coordinates;
else if (line.type === 'LineString') coords = line.geometry.coordinates;
else if (line.type === 'LineString') coords = line.coordinates;
else throw new Error('input must be a LineString Feature or Geometry');

var travelled = 0;
Expand Down
8 changes: 4 additions & 4 deletions packages/turf-along/test.js
Expand Up @@ -7,13 +7,13 @@ var line = JSON.parse(fs.readFileSync(__dirname + '/test/fixtures/dc-line.geojso

test('turf-along', function (t) {
var pt1 = along(line, 1, 'miles');
var pt2 = along(line, 1.2, 'miles');
var pt2 = along(line.geometry, 1.2, 'miles');
var pt3 = along(line, 1.4, 'miles');
var pt4 = along(line, 1.6, 'miles');
var pt4 = along(line.geometry, 1.6, 'miles');
var pt5 = along(line, 1.8, 'miles');
var pt6 = along(line, 2, 'miles');
var pt6 = along(line.geometry, 2, 'miles');
var pt7 = along(line, 100, 'miles');
var pt8 = along(line, 0, 'miles');
var pt8 = along(line.geometry, 0, 'miles');
var fc = featurecollection([pt1,pt2,pt3,pt4,pt5,pt6,pt7,pt8]);

fc.features.forEach(function (f) {
Expand Down

0 comments on commit f856628

Please sign in to comment.