Skip to content

Commit

Permalink
various cleanup and fixups to arc.GreatCircle ctor change
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Feb 11, 2014
1 parent e4a9619 commit 39cd82f
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 2,771 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_store
node_modules
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
example
node_modules
index.html
7 changes: 6 additions & 1 deletion arc.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ Arc.prototype.wkt = function() {
*
*/
var GreatCircle = function(start,end,properties) {

if (!start || start.x === undefined || start.y === undefined) {
throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");
}
if (!end || end.x === undefined || end.y === undefined) {
throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");
}
this.start = new Coord(start.x,start.y);
this.end = new Coord(end.x,end.y);
this.properties = properties || {};
Expand Down
69 changes: 0 additions & 69 deletions bezier.geojson

This file was deleted.

139 changes: 0 additions & 139 deletions bezier.html

This file was deleted.

35 changes: 0 additions & 35 deletions bezier.js

This file was deleted.

87 changes: 0 additions & 87 deletions bezier.py

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions example/csv2arc.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ csv_lines.forEach(function(row,idx) {
var end_y = parseFloat(coords[3].trim()); // second latitude

// now create special arc Coordinate objects from the start and end pairs
var start = new arc.Coord(start_x, start_y);
var end = new arc.Coord(end_x, end_y);
var start = {x: start_x, y: start_y};
var end = {x: end_x, y: end_y};


/* handle properties (csv attributes) second */
Expand Down
8 changes: 4 additions & 4 deletions example/round.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var fs = require('fs'),
arc = require('../arc');

var geojson = JSON.parse(fs.readFileSync('tracks.geojson', 'utf-8'));
var geojson = JSON.parse(fs.readFileSync(__dirname + '/tracks.geojson', 'utf-8'));

var tolerance = 1;

Expand All @@ -17,8 +17,8 @@ for (var i = 0; i < geojson.features.length; i++) {
Math.abs(a[1] - b[1]));
if (dist > tolerance) {
var gc = new arc.GreatCircle(
new arc.Coord(a[0], a[1]),
new arc.Coord(b[0], b[1]));
{ x: a[0], y: a[1] },
{ x: b[0], y: b[1] });
var line = gc.Arc(10);
geojson.features[i].geometry.coordinates[j].arc = line.coords;
}
Expand All @@ -35,4 +35,4 @@ for (var i = 0; i < geojson.features.length; i++) {
}
}

fs.writeFileSync('tracks_round.geojson', JSON.stringify(geojson));
console.log(JSON.stringify(geojson));
Loading

0 comments on commit 39cd82f

Please sign in to comment.