Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arc

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arc - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

.github/workflows/tests.yml

17

arc.js

@@ -13,2 +13,17 @@ 'use strict';

var roundCoords = function(coords) {
// round coordinate decimal values to 6 places
var PRECISION = 6;
var MULTIPLIER = Math.pow(10, PRECISION)
for (var i = 0; i < coords.length; i++) {
// https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary
coords[i] = Math.round(
(coords[i] + Number.EPSILON) * MULTIPLIER
) / MULTIPLIER
}
return coords;
}
Coord.prototype.view = function() {

@@ -244,3 +259,3 @@ return String(this.lon).slice(0, 4) + ',' + String(this.lat).slice(0, 4);

for (var j0 = 0; j0 < points.length; ++j0) {
line.move_to(points[j0]);
line.move_to(roundCoords(points[j0]));
}

@@ -247,0 +262,0 @@ }

@@ -1,17 +0,41 @@

# v0.1.3
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased][unreleased]
## [0.1.4] - 2022-11-16
### Changed
- Limit output precision to six decimal places
## [0.1.3] - 2022-05-09
### Fixed
- Fix bug when generating string for Antipodal error
# v0.1.2
## [0.1.2] - 2021-10-13
### Fixed
- Fix link to algorithm used in documentation (https://github.com/springmeyer/arc.js/pull/40)
# v0.1.1
## [0.1.1] - 2018-06-20
### Added
- Support browserify (https://github.com/springmeyer/arc.js/pull/26)
# v0.1.0
## 0.1.0 - 2014-02-11
### Changed
- Changed GreatCircle constructor to expect objects like `{x:-122,y:48}` for start/end rather than arc.Coord objects
### Added
- Added mocha tests
### Fixed
- Fixed jshint strict errors
[unreleased]: https://github.com/springmeyer/arc.js/compare/v0.1.4..HEAD
[0.1.4]: https://github.com/springmeyer/arc.js/compare/v0.1.3...v0.1.4
[0.1.3]: https://github.com/springmeyer/arc.js/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/springmeyer/arc.js/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/springmeyer/arc.js/compare/v0.1.0...v0.1.1

12

package.json
{
"name": "arc",
"version": "0.1.3",
"version": "0.1.4",
"description": "draw great circle arcs",

@@ -34,12 +34,4 @@ "url": "https://github.com/springmeyer/arc.js",

"devDependencies": {
"tape": "~2.12.1"
},
"testling": {
"files": "test/*.js",
"browsers": [
"chrome/22..latest",
"firefox/16..latest",
"safari/latest"
]
"tape": "~5.5.3"
}
}

@@ -15,6 +15,2 @@ # arc.js

```bash
$ bower install --save arc.js
```
## License

@@ -70,11 +66,17 @@

> line
{ properties: { name: 'Seattle to DC' },
coords:
[ [ -122, 48.00000000000001 ],
[ -112.06161978373486, 47.7241672604096 ],
[ -102.38404317022653, 46.60813199882492 ],
[ -93.22718895342909, 44.716217302635705 ],
[ -84.74823988299501, 42.14415510795357 ],
[ -77, 38.99999999999999 ] ],
length: 6 }
{
properties: { name: 'Seattle to DC' },
geometries: [
{
coords:
[ [ -122, 48 ],
[ -112.06162, 47.724167 ],
[ -102.384043, 46.608132 ],
[ -93.227189, 44.716217 ],
[ -84.74824, 42.144155 ],
[ -77, 39 ] ],
length: 6
}
]
}
```

@@ -94,3 +96,3 @@

> line.json();
{ geometry:
{ geometry:
{ type: 'LineString',

@@ -106,5 +108,5 @@ coordinates: [ [Object], [Object], [Object], [Object], [Object], [Object] ] },

> line.wkt();
'LINESTRING(-122 48.00000000000001,-112.06161978373486 47.7241672604096,-102.38404317022653 46.60813199882492,-93.22718895342909 44.716217302635705,-84.74823988299501 42.14415510795357,-77 38.99999999999999)'
'LINESTRING(-122 48,-112.061619 47.724167,-102.384043 46.608131,-93.227188 44.716217,-84.748239 42.144155,-77 38.999999)'
```
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.
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 feature collection from multiple routes.

@@ -67,10 +67,18 @@ 'use strict';

var arcs = [
{"properties":{"name":"Seattle to DC"},"geometries":[{"coords":[[-122,48.00000000000001],[-97.72808611752785,45.75368189927002],[-77,38.99999999999999]],"length":3}]},
{"properties":{"name":"Seattle to London"},"geometries":[{"coords":[[-122,48.00000000000001],[-64.16590091973099,67.47624207149578],[0,51]],"length":3}]},
{"properties":{"name":"crosses dateline 1"},"geometries":[{"coords":[[-75.9375,35.46066995149531],[-136.82303405489677,-10.367409282634164],[146.25,-43.06888777416961]],"length":3}]},
{"properties":{"name":"crosses dateline 2"},"geometries":[{"coords":[[145.54687500000003,48.45835188280866],[-157.28484118689477,8.44205355944752],[-112.5,-37.71859032558814]],"length":3}]},
{"properties":{"name":"south 1"},"geometries":[{"coords":[[-74.564208984375,-0.17578097424708533],[-140.44327137076033,-35.80108605508993],[137.779541015625,-22.755920681486387]],"length":3}]},
{"properties":{"name":"south 2"},"geometries":[{"coords":[[-66.829833984375,-18.812717856407765],[-146.78177837397814,-82.1795027896656],[118.795166015625,-20.79720143430698]],"length":3}]}
{"properties":{"name":"Seattle to DC"},"geometries":[{"coords":[[-122,48],[-97.728086,45.753682],[-77,39]],"length":3}]},
{"properties":{"name":"Seattle to London"},"geometries":[{"coords":[[-122,48],[-64.165901,67.476242],[0,51]],"length":3}]},
{"properties":{"name":"crosses dateline 1"},"geometries":[{"coords":[[-75.9375,35.46067],[-136.823034,-10.367409],[146.25,-43.068888]],"length":3}]},
{"properties":{"name":"crosses dateline 2"},"geometries":[{"coords":[[145.546875,48.458352],[-157.284841,8.442054],[-112.500000,-37.718590]],"length":3}]},
{"properties":{"name":"south 1"},"geometries":[{"coords":[[-74.564209,-0.175781],[-140.443271,-35.801086],[137.779541,-22.755921]],"length":3}]},
{"properties":{"name":"south 2"},"geometries":[{"coords":[[-66.829834,-18.812718],[-146.781778,-82.179503],[118.795166,-20.797201]],"length":3}]}
];
var wkts = [
'LINESTRING(-122 48,-97.728086 45.753682,-77 39)',
'LINESTRING(-122 48,-64.165901 67.476242,0 51)',
'LINESTRING(-75.9375 35.46067,-136.823034 -10.367409,146.25 -43.068888)',
'LINESTRING(145.546875 48.458352,-157.284841 8.442054,-112.5 -37.71859)',
'LINESTRING(-74.564209 -0.175781,-140.443271 -35.801086,137.779541 -22.755921)',
'LINESTRING(-66.829834 -18.812718,-146.781778 -82.179503,118.795166 -20.797201)',
]

@@ -81,4 +89,4 @@ test('Routes', function(t) {

var line = gc.Arc(3);
//console.log(JSON.stringify(line))
t.deepEqual(line,arcs[idx]);
t.deepEqual(JSON.stringify(line), JSON.stringify(arcs[idx]));
t.equal(line.wkt(), wkts[idx]);
});

@@ -85,0 +93,0 @@ t.end();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc