{"name":"arc","version":"1.0.0","description":"draw great circle arcs","url":"https://github.com/springmeyer/arc.js","keywords":["maps","spherical","globe","rhumb line","crow flies","great circle","typescript"],"contributors":[{"name":"Dane Springmeyer","email":"dane.springmeyer@gmail.com"},{"name":"John Gravois","email":"jagravois@gmail.com"},{"name":"Thomas Hervey","email":"thomasahervey@gmail.com"}],"repository":{"type":"git","url":"git://github.com/springmeyer/arc.js.git"},"license":"BSD","type":"module","exports":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"engines":{"node":">=18"},"scripts":{"build":"npm run clean && tsc","clean":"rm -rf dist/","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","prepublishOnly":"npm run build"},"devDependencies":{"@types/geojson":"^7946.0.16","@types/jest":"^30.0.0","@types/node":"^24.0.0","expect-type":"^1.2.2","jest":"^29.7.0","ts-jest":"^29.4.3","typescript":"^5.0.0"},"gitHead":"68de493aa4cc81b7121e13d91de4bcbfd895e1ca","_id":"arc@1.0.0","bugs":{"url":"https://github.com/springmeyer/arc.js/issues"},"homepage":"https://github.com/springmeyer/arc.js#readme","_nodeVersion":"24.14.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-Y1czl0GTrN/CAyZczn/kgZZ5EnOHLqLog2kdp/Cw00IDt1aq0UC5zdZQ5EjA0ucaqDc2F2AUs0dss9QUWnSc/w==","shasum":"d4bbed54a76542b384facd2738840f69fb25d040","tarball":"http://registry-npm.ywwl.com/arc/download/arc-1.0.0.tgz","fileCount":39,"unpackedSize":60237,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEY7VAqsSmPpy/cByg5pAX1hSvP+3ENKrxBA4bcVM9PAAiEAs1V6OEjYp4FqKbkHqqfw6dIdiQ5SiTPcP3vSsVYU7lY="}],"size":16388,"noattachment":false,"key":"/arc/-/arc-1.0.0.tgz"},"_npmUser":{"name":"jgravois","email":"jagravois@gmail.com"},"directories":{},"maintainers":[{"name":"springmeyer","email":"dane.springmeyer@gmail.com"},{"name":"jgravois","email":"jagravois@gmail.com"},{"name":"tmcw","email":"tom@macwright.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/arc_1.0.0_1776109042231_0.391399537213323"},"_hasShrinkwrap":false,"readme":"# arc.js\n\nCalculate great circle routes as lines in GeoJSON or WKT format.\n\n[**🌍 Try the interactive demo**](https://danespringmeyer.com/arc.js/) - Click to plot great circle arcs on a map!\n\n**Features:**\n- Full TypeScript support with type definitions\n- Works in Node.js and browsers\n- Generates GeoJSON and WKT output formats\n- Handles dateline crossing automatically\n- Based on [Ed Williams' Aviation Formulary](https://edwilliams.org/avform.htm#Intermediate) algorithms\n\n## Installation\n\n```bash\nnpm install arc\n```\n\n## Quick Start\n\n```js\nimport { GreatCircle } from 'arc';\nconst gc = new GreatCircle({x: -122, y: 48}, {x: -77, y: 39});\nconst line = gc.Arc(); // npoints is optional, defaults to 100\nconsole.log(line.json()); // GeoJSON output\n```\n\n### TypeScript\n```typescript\nimport { GreatCircle, CoordinatePoint } from 'arc';\n\nconst start: CoordinatePoint = { x: -122, y: 48 };\nconst end: CoordinatePoint = { x: -77, y: 39 };\nconst gc = new GreatCircle(start, end);\nconst line = gc.Arc(100);\n```\n\n### Browser (ESM)\n```html\n<script type=\"module\">\n  import { GreatCircle } from 'https://cdn.skypack.dev/arc@1';\n  const gc = new GreatCircle({x: -122, y: 48}, {x: -77, y: 39});\n  const line = gc.Arc();\n</script>\n```\n\n## API Reference\n\n### Basic Usage\n\n#### 1. Define coordinates\nCoordinates use `x` for longitude and `y` for latitude (both in degrees):\n\n```js\nconst start = { x: -122, y: 48 };  // Seattle\nconst end = { x: -77, y: 39 };     // Washington DC\n```\n\n#### 2. Create a GreatCircle\n```js\nconst gc = new GreatCircle(start, end, { name: 'Seattle to DC' });\n```\n\n#### 3. Generate the arc\n```js\nconst line = gc.Arc();      // defaults to 100 points\nconst line = gc.Arc(500);   // or specify a custom value\n```\n\n**Parameters:**\n- `npoints` (number, optional): Number of intermediate points (higher = more precise, default: 100)\n\n### TypeScript Support\n\n```typescript\nimport { GreatCircle, CoordinatePoint, ArcOptions } from 'arc';\n\n// Define custom properties interface\ninterface RouteProperties {\n  name: string;\n  color?: string;\n}\n\nconst start: CoordinatePoint = { x: -122, y: 48 };\nconst end: CoordinatePoint = { x: -77, y: 39 };\nconst properties: RouteProperties = { name: 'Seattle to DC', color: 'blue' };\n\nconst gc = new GreatCircle(start, end, properties);\nconst line = gc.Arc(); // npoints is optional, defaults to 100\n\n// Fully typed return values\nconst geojson = line.json(); // GeoJSONFeature\nconst wkt = line.wkt();      // string\n```\n\n**Available Types:** `CoordinatePoint`, `ArcOptions`, `Coord`, `GreatCircle`, `Arc`, `GeoJSONFeature`\n\n### Output Formats\n\n#### Raw Arc Object\nThe generated arc contains intermediate coordinate pairs:\n\n```js\n{\n  properties: { name: 'Seattle to DC' },\n  geometries: [\n    {\n      coords: [\n        [-122, 48],\n        [-112.06162, 47.724167],\n        [-102.384043, 46.608132],\n        [-93.227189, 44.716217],\n        [-84.74824, 42.144155],\n        [-77, 39]\n      ],\n      length: 6\n    }\n  ]\n}\n```\n\n#### GeoJSON Format\n```js\nconst geojson = line.json();\n// Returns:\n{\n  type: 'Feature',\n  geometry: {\n    type: 'LineString',\n    coordinates: [[-122, 48], [-112.06162, 47.724167], ...]\n  },\n  properties: { name: 'Seattle to DC' }\n}\n```\n\n#### WKT Format\n```js\nconst wkt = line.wkt();\n// Returns:\n'LINESTRING(-122 48,-112.061619 47.724167,-102.384043 46.608131,...)'\n```\n\n### Dateline Crossing\n\nRoutes that cross the international dateline are automatically detected and split into a `MultiLineString` with exact `±180°` boundary points. No configuration is needed.\n\n## Examples\n\nSee the [interactive demo](https://danespringmeyer.com/arc.js/) for sample code showing how to create GeoJSON feature collections from multiple routes.\n\n## Used in Turf.js\n\narc.js powers the [`greatCircle`](https://turfjs.org/docs/api/greatCircle) function in [Turf.js](https://turfjs.org/), a popular geospatial JavaScript library. You can use great circle calculations directly through Turf:\n\n## License\n\nThis project is licensed under the BSD license. See [LICENSE.md](LICENSE) for details.\n","publish_time":1776109042388,"_cnpm_publish_time":1776109042388,"dist-tags":{"beta":"1.0.0-beta.1","latest":"1.0.0"}}