{"name":"arc","version":"1.0.0-beta.1","keywords":["maps","spherical","globe","rhumb line","crow flies","great circle","typescript"],"license":"BSD","_id":"arc@1.0.0-beta.1","maintainers":[{"name":"springmeyer","email":"dane.springmeyer@gmail.com"},{"name":"jgravois","email":"jagravois@gmail.com"},{"name":"tmcw","email":"tom@macwright.com"}],"contributors":[{"name":"Dane Springmeyer","email":"dane.springmeyer@gmail.com"},{"name":"John Gravois","email":"jagravois@gmail.com"}],"homepage":"https://github.com/springmeyer/arc.js#readme","bugs":{"url":"https://github.com/springmeyer/arc.js/issues"},"url":"https://github.com/springmeyer/arc.js","dist":{"shasum":"d7ed4f6cb55b4a671a4b53fde88b3863d5616519","tarball":"http://registry-npm.ywwl.com/arc/download/arc-1.0.0-beta.1.tgz","fileCount":33,"integrity":"sha512-AT6tr6VWpuzzaz2pKWW1oX7VpYC3yDtfhqf7UKToeVRjF1S3PRjMLxJ9rNLkVQRsVb/+zHy8d6ScUtZbb7dn3g==","signatures":[{"sig":"MEQCIAjvOUi+R28lvhPTqm7LnO6hbWDaBxXZZSFrb+gH/N0rAiBCq7duiNEij5qm8uJVjgcxSYRh0+/vRLcKqH32/5ETzA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51672,"size":14246,"noattachment":false,"key":"/arc/-/arc-1.0.0-beta.1.tgz"},"type":"module","engines":{"node":">=18"},"exports":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"gitHead":"325c6c3dd9e7d0f2ba0cd9944ff6f88bd8154ecd","scripts":{"test":"jest","build":"npm run clean && tsc","clean":"rm -rf dist/","test:watch":"jest --watch","test:coverage":"jest --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"jgravois","email":"jagravois@gmail.com"},"repository":{"url":"git://github.com/springmeyer/arc.js.git","type":"git"},"_npmVersion":"11.9.0","description":"draw great circle arcs","directories":{},"_nodeVersion":"24.14.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^29.7.0","ts-jest":"^29.4.3","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^24.0.0","expect-type":"^1.2.2","@types/geojson":"^7946.0.16"},"_npmOperationalInternal":{"tmp":"tmp/arc_1.0.0-beta.1_1774826450865_0.6597344057058105","host":"s3://npm-registry-packages-npm-production"},"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":1774826451004,"_cnpm_publish_time":1774826451004,"dist-tags":{"beta":"1.0.0-beta.1","latest":"1.0.0"}}