Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix turf-along using raw geometry #376

Merged
merged 2 commits into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/turf-along/index.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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