{"name":"arc","version":"0.2.0","keywords":["maps","spherical","globe","rhumb line","crow flies","great circle","typescript"],"_id":"arc@0.2.0","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"}],"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":"afce1bffa736c857c3b00acd274040e5303e9339","tarball":"http://registry-npm.ywwl.com/arc/download/arc-0.2.0.tgz","fileCount":48,"integrity":"sha512-8NFOo126uYKQJyXNSLY/jSklgfLQL+XWAcPXGo876JwEQ8nSOPXWNI3TV2jLZMN8QEw8uksJ1ZwS4npjBca8MA==","signatures":[{"sig":"MEUCIDXzlBROUAk0F6xTzATY64bRgW9vlsylObMXqW+4Do5ZAiEAoRcJPhjWYL+xesqEvfzwBbdVGeTKoT07ZgZeg5kHmrY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":98357,"size":17422,"noattachment":false,"key":"/arc/-/arc-0.2.0.tgz"},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=0.4.0"},"gitHead":"d15f0a41335af52a37cf6073a4ff3cfa3c46f274","scripts":{"test":"jest","build":"npm run clean && tsc && tsc -p tsconfig.esm.json && npm run build:browser","clean":"rm -rf dist/ && rm -f arc.js","test:all":"npm run test && npm run test:build","test:build":"node test/build-output.test.js","test:watch":"jest --watch","build:browser":"esbuild src/index.ts --bundle --format=iife --global-name=arc --outfile=arc.js --platform=browser","test:coverage":"jest --coverage","prepublishOnly":"npm run build"},"_npmUser":{"name":"springmeyer","email":"dane.springmeyer@gmail.com"},"licenses":[{"type":"BSD"}],"repository":{"url":"git://github.com/springmeyer/arc.js.git","type":"git"},"_npmVersion":"11.4.1","description":"draw great circle arcs","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","esbuild":"^0.25.9","ts-jest":"^29.4.3","typescript":"^5.0.0","@types/jest":"^30.0.0","@types/node":"^20.0.0","expect-type":"^1.2.2","@types/geojson":"^7946.0.16"},"_npmOperationalInternal":{"tmp":"tmp/arc_0.2.0_1758600767001_0.4016285342139776","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":1758600767207,"_cnpm_publish_time":1758600767207,"dist-tags":{"beta":"1.0.0-beta.1","latest":"1.0.0"}}