Skip to content
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 .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [16, 18, 20, 22, 24]
node: [18, 20, 22, 24]

steps:
- uses: actions/checkout@v6
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_store
node_modules
coverage
dist/
arc.js
dist
4 changes: 0 additions & 4 deletions .npmignore
Copy link
Copy Markdown
Collaborator Author

@jgravois jgravois Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the package.json has a files whitelist, i'm pretty sure the .npmignore blacklist is irrelevant/redundant.

This file was deleted.

33 changes: 31 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,36 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]

## [1.0.0] - 2026-03-29

### Breaking change

- arc.js is now a [pure](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) ESM package.

If you need to `require()` arc.js as CJS (CommonJS), or have a runtime older than Node.js 18, please use `0.1.4`.

0.x syntax:
```js
const arc = require('arc');
const gc = new arc.GreatCircle(/* */);
```

1.x syntax:
```js
import { GreatCircle } from 'arc';
const gc = new GreatCircle(/* */);
```

### Fixed

- antimeridian splitting in GreatCircle.Arc (From @copilot)

## [0.2.0] - 2025-09-22
### Breaking
- Node.js 16 is now the minimum supported runtime

### Changed
- TypeScript support with back compatibilty (From @thomas-hervey)
- TypeScript support with backwards compatibility (From @thomas-hervey)

## [0.1.4] - 2022-11-16
### Changed
Expand Down Expand Up @@ -39,7 +66,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Fixed jshint strict errors

[unreleased]: https://github.com/springmeyer/arc.js/compare/v0.1.4..HEAD
[unreleased]: https://github.com/springmeyer/arc.js/compare/v1.0.0..HEAD
[1.0.0]: https://github.com/springmeyer/arc.js/compare/v0.2.0...v1.0.0
[0.2.0]: https://github.com/springmeyer/arc.js/compare/v0.1.4...v0.2.0
[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
Expand Down
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Calculate great circle routes as lines in GeoJSON or WKT format.

**Features:**
- Full TypeScript support with type definitions
- Works in Node.js (CommonJS & ES modules) and browsers
- Works in Node.js and browsers
- Generates GeoJSON and WKT output formats
- Handles dateline crossing automatically
- Based on [Ed Williams' Aviation Formulary](https://edwilliams.org/avform.htm#Intermediate) algorithms and the GDAL source code
Expand All @@ -19,15 +19,6 @@ npm install arc

## Quick Start

### CommonJS (Node.js)
```js
const arc = require('arc');
const gc = new arc.GreatCircle({x: -122, y: 48}, {x: -77, y: 39});
const line = gc.Arc(100);
console.log(line.json()); // GeoJSON output
```

### ES Modules (Node.js, bundlers)
```js
import { GreatCircle } from 'arc';
const gc = new GreatCircle({x: -122, y: 48}, {x: -77, y: 39});
Expand All @@ -45,10 +36,10 @@ const gc = new GreatCircle(start, end);
const line = gc.Arc(100);
```

### Browser (Global)
### Browser (ESM)
```html
<script src="./arc.js"></script>
<script>
<script type="module">
import { GreatCircle } from 'https://cdn.skypack.dev/arc@1';
const gc = new arc.GreatCircle({x: -122, y: 48}, {x: -77, y: 39});
const line = gc.Arc(100);
</script>
Expand Down Expand Up @@ -165,7 +156,7 @@ arc.js powers the [`greatCircle`](https://turfjs.org/docs/api/greatCircle) funct

## License

This project is licensed under the BSD license. See [LICENSE.md](LICENSE.md) for details.
This project is licensed under the BSD license. See [LICENSE.md](LICENSE) for details.

### Third-Party Licenses

Expand Down
17 changes: 10 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<title>arc.js - Great Circle Routes Demo</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<script src="./arc.js"></script>
<style>
* {
box-sizing: border-box;
Expand Down Expand Up @@ -340,8 +339,8 @@ <h3>Settings</h3>
</div>

<div class="control-group">
<button class="btn" onclick="clearMap()">Clear All</button>
<button class="btn btn-danger" onclick="resetView()">Reset View</button>
<button id="clear" class="btn">Clear All</button>
<button id="reset" class="btn btn-danger">Reset View</button>
Comment on lines +342 to +343
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since modules avoid polluting the global scope, we have to wire up the click handlers slightly differently.

</div>
</div>

Expand All @@ -357,8 +356,9 @@ <h4>Generated GeoJSON</h4>
</div>
</div>
</div>

<script>
<script type="module">
import { GreatCircle } from 'https://cdn.skypack.dev/arc@1';
Copy link
Copy Markdown
Collaborator Author

@jgravois jgravois Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't work until we actually publish v1.0.0.

in the interim, either of the two below should work:

        import { GreatCircle } from 'https://cdn.skypack.dev/-/arc@v1.0.0-beta.1';
        import { GreatCircle } from './dist/index.js';


// Initialize map
var map = L.map('map').setView(new L.LatLng(0, 0), 2);
var idx = 1;
Expand Down Expand Up @@ -468,7 +468,7 @@ <h4>Generated GeoJSON</h4>
distance: calculateDistance(from, to)
};

var greatCircle = new arc.GreatCircle(from, to, properties);
var greatCircle = new GreatCircle(from, to, properties);
var gc = greatCircle.Arc(npoints, { offset: offset });
var line = new L.geoJson().addTo(map);
var geojson_feature = gc.json();
Expand Down Expand Up @@ -591,7 +591,7 @@ <h4>Generated GeoJSON</h4>
};

try {
var greatCircle = new arc.GreatCircle(nyc, london, properties);
var greatCircle = new GreatCircle(nyc, london, properties);
var gc = greatCircle.Arc(npoints, { offset: offset });
var line = new L.geoJson().addTo(map);
var geojson_feature = gc.json();
Expand Down Expand Up @@ -629,6 +629,9 @@ <h4>Generated GeoJSON</h4>

// Initialize JSON output
updateJsonOutput();

document.querySelector('#clear').addEventListener('click', clearMap);
document.querySelector('#reset').addEventListener('click', resetView);
</script>
</body>
</html>
1 change: 0 additions & 1 deletion index.js

This file was deleted.

2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
// Use ts-jest preset for TypeScript support
preset: 'ts-jest',

Expand Down
Loading
Loading