| var arc = require('../'); | ||
| var assert = require('assert'); | ||
| describe('Arc.js', function() { | ||
| it('should be able to create an arc.Coord', function() { | ||
| var coord = new arc.Coord(0,0); | ||
| assert.equal(coord.lon,0); | ||
| assert.equal(coord.lat,0); | ||
| assert.equal(coord.x,0); | ||
| assert.equal(coord.y,0); | ||
| }); | ||
| }); |
+1
-1
@@ -126,3 +126,3 @@ var D2R = Math.PI / 180; | ||
| //var maxx = 0; | ||
| if (npoints <= 2) { | ||
| if (!npoints || npoints <= 2) { | ||
| first_pass.push([this.start.lon, this.start.lat]); | ||
@@ -129,0 +129,0 @@ first_pass.push([this.end.lon, this.end.lat]); |
+2
-6
@@ -6,8 +6,4 @@ <!DOCTYPE html> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css" /> | ||
| <!--[if lte IE 8]> | ||
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.ie.css" /> | ||
| <![endif]--> | ||
| <script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script> | ||
| <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" /> | ||
| <script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js?2"></script> | ||
| <script src="./arc.js"></script> | ||
@@ -14,0 +10,0 @@ <style> |
+16
-13
| { | ||
| "name": "arc", | ||
| "version": "0.0.3", | ||
| "description": "draw great circle arcs", | ||
| "url": "https://github.com/springmeyer/arc.js", | ||
| "keywords": [ | ||
| "maps", | ||
| "spherical", | ||
| "globe", | ||
| "rhumb line", | ||
| "crow flies", | ||
| "great circle" | ||
| "maps", | ||
| "spherical", | ||
| "globe", | ||
| "rhumb line", | ||
| "crow flies", | ||
| "great circle" | ||
| ], | ||
| "contributors": [ | ||
| "Dane Springmeyer <dane@dbsgeo.com>" | ||
| "Dane Springmeyer <dane@dbsgeo.com>" | ||
| ], | ||
| "version": "0.0.2", | ||
| "repository" : { | ||
| "type" : "git", | ||
| "url" : "git://github.com/springmeyer/arc.js.git" | ||
| }, | ||
| "licenses": [{ | ||
| "type": "BSD" | ||
| "type": "BSD" | ||
| }], | ||
| "main": "./index", | ||
| "engines": { | ||
| "node": ">=0.4.0" | ||
| "node": ">=0.4.0" | ||
| }, | ||
| "dependencies": { | ||
| }, | ||
| "devDependencies": { | ||
| "scripts" : { | ||
| "test" : "mocha -R spec" | ||
| } | ||
| } |
+31
-10
@@ -17,14 +17,36 @@ # arc.js | ||
| The idea is you may have one or many start and end points. | ||
| Require the library in node.js like: | ||
| Create Coordinate pairs from the longitude (x) and latitude (y) values | ||
| of each place and pass these (and optionally a properties object), to the GreatCircle | ||
| constructor: | ||
| var arc = require('arc'); | ||
| Use in the browser like: | ||
| <script src="./arc.js"></script> | ||
| The API works like so: | ||
| **1)** Create start and end coordinates | ||
| First we need to declare where the arc should start and end | ||
| var start = new arc.Coord(-122, 48); | ||
| var end = new arc.Coord(-77, 39); | ||
| These are `[lon,lat]` pairs like GeoJSON. Be aware that Leaflet uses `[lat,lon]` order [currently](https://github.com/Leaflet/Leaflet/issues/1455). | ||
| **2)** Create GreatCircle object | ||
| Next we pass the start/end to the `GreatCircle` constructor, along with an optional object representing the properties for this future line. | ||
| var gc = new arc.GreatCircle(start, end, {'name': 'Seattle to DC'}); | ||
| var line = gc.Arc(6); | ||
| **3)** Generate a line | ||
| Then call the `Arc` function to generate a line: | ||
| var npoints = 6; | ||
| var line = gc.Arc(npoints); | ||
| The `npoints` argument specifies the number of intermediate vertices you want in the resulting line. The higher the number the more dense and accurate the line will be. | ||
| Then `line` will be a raw sequence of the start and end coordinates plus an arc of | ||
@@ -44,5 +66,4 @@ intermediate coordinate pairs. | ||
| You can then serialize to a GeoJSON geometry: | ||
| You can then serialize to a GeoJSON geometry format: | ||
| > line.json(); | ||
@@ -55,2 +76,3 @@ { geometry: | ||
| Or to WKT (Well known text): | ||
@@ -61,4 +83,3 @@ | ||
| It is then up to you to add up these features to create fully fledged geodata. See the examples/ directory | ||
| for sample code to create a GeoJSON file from multiple routes. | ||
| It is then up to you to add up these features to create fully fledged geodata. See the examples/ directory for sample code to create GeoJSON feature collection from multiple routes. |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
303996
0.31%35
2.94%3623
0.3%82
34.43%5
-16.67%5
-16.67%