{"name":"arc","version":"0.1.3","description":"draw great circle arcs","url":"https://github.com/springmeyer/arc.js","keywords":["maps","spherical","globe","rhumb line","crow flies","great circle"],"contributors":[{"name":"Dane Springmeyer","email":"dane@dbsgeo.com"}],"repository":{"type":"git","url":"git://github.com/springmeyer/arc.js.git"},"licenses":[{"type":"BSD"}],"main":"./index","engines":{"node":">=0.4.0"},"scripts":{"test":"tape test/*.js"},"devDependencies":{"tape":"~2.12.1"},"testling":{"files":"test/*.js","browsers":["chrome/22..latest","firefox/16..latest","safari/latest"]},"gitHead":"a6832680613666c7c873236bcf9376938436520c","bugs":{"url":"https://github.com/springmeyer/arc.js/issues"},"homepage":"https://github.com/springmeyer/arc.js#readme","_id":"arc@0.1.3","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-fVbOgkrD0dhJjyWdPRBuslnHj7YOrjtFBUdkBui56m+JmIT0uXszdKNf5dCm4xfHH77kNBvsrO0NNMt+j3CW8w==","shasum":"130a6cd4662061ec99fad3e78c1e4a9a04540789","tarball":"http://registry-npm.ywwl.com/arc/download/arc-0.1.3.tgz","fileCount":10,"unpackedSize":19432,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNHoPj1F8G8q8VOtanuOiLF/Lq6RE9ny4RNa9t6jk+ngIhAJP7cpMgYgFD/AMXsfewajp4HWzBcnRL5Ip+lDwlVOPI"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJieXeEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpO6A/+K2bBskubB22d7dHuVVsWMru0+35sdGz6nln5gyeRBTQ170Zi\r\n5HnelLvvWN/MKbIslA2U0rQ3VnTG59aiSpDhPhUm797PdQtKEQG0UuTm/8H4\r\nwRM1MIjCyl0gl7UszRSfpt/BCYpqyKAKStlIEdY1FFTgzxYFXHOyIN1yJU0Z\r\ndaDuUttgSb/gHsX1u+vgMTeuXSPnRO6GZ5VcIlhMJQtP1pQpwdH4sgwGehTi\r\nPKE3h5Z7fJ5hhiRJ4ZJGudymeyFgOmJnvessJgiHXVOhYUUogZqM7pDCcry8\r\nVHLnFj/R3Hfz6hMF2QwrYxrdcw+0sK3E9u7bTvI0q/jjXgu0sZETyj2PRFxy\r\nrazdEjx2FjWjBob5RVM7x6/UvwktdE67KjqEDcjRZyjE3D8zoiMPII+DJODO\r\nFW99c53QSzRLIqtqurBAH5HkcAf9a7EbuUHZYqj4DOcGCX2Hqnz5HKloF7dZ\r\nDlHR4qMKy704+9FJMsdkAtKHH8yPkWlJIcTcJqvzCK3HgcqSax88QxN/LQI4\r\nvFk9mk2SonD2c8Nzj1uqefqGOoHSV50TGvwQY0wEWCUarFWgk8MVcC2biFjZ\r\n2iu5hVeomBcpKSZSdPZWb+9fN9XMGpiSokWZqWeG7n6sAl5zmJRj4dQBw8ET\r\nQ9Y1xRjdnY8odhtuLOvUN4JOP5uvGV/zaNQ=\r\n=yNCD\r\n-----END PGP SIGNATURE-----\r\n","size":6787,"noattachment":false,"key":"/arc/-/arc-0.1.3.tgz"},"_npmUser":{"name":"jgravois","email":"john@scripto.computer"},"directories":{},"maintainers":[{"name":"springmeyer","email":"dane@mapbox.com"},{"name":"jgravois","email":"john@scripto.computer"},{"name":"tmcw","email":"tom@macwright.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/arc_0.1.3_1652127620669_0.2789412827746163"},"_hasShrinkwrap":false,"readme":"# arc.js\n> Calculate great circles routes as lines in GeoJSON or WKT format.\n\nAlgorithms from https://edwilliams.org/avform.htm#Intermediate\n\nIncludes basic support for splitting lines that cross the dateline, based on\na partial port of code from OGR.\n\n## Install\n\n```bash\n$ npm install --save arc\n```\n\n## License\n\nBSD\n\n## Usage\n\nRequire the library in node.js like:\n```js\nvar arc = require('arc');\n```\n\nUse in the browser like:\n```html\n<script src=\"./arc.js\"></script>\n```\n\n## API\n\n**1)** Create start and end coordinates\n\nFirst we need to declare where the arc should start and end\n\n```js\nvar start = { x: -122, y: 48 };\nvar end = { x: -77, y: 39 };\n```\n\nNote that `x` here is longitude in degrees and `y` is latitude in degrees.\n\n**2)** Create GreatCircle object\n\nNext we pass the start/end to the `GreatCircle` constructor, along with an optional object representing the properties for this future line.\n\n```js\nvar generator = new arc.GreatCircle(start, end, {'name': 'Seattle to DC'});\n```\n\n**3)** Generate a line arc\n\nThen call the `Arc` function on the `GreatCircle` object to generate a line:\n\n```js\nvar line = generator.Arc(100,{offset:10});\n```\n\nThe `line` will be a raw sequence of the start and end coordinates plus an arc of\nintermediate coordinate pairs.\n\n```js\n> line\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      length: 6\n    }\n  ]\n}\n```\n\n#### Arc options\n\nThe first argument to `Arc` specifies the number of intermediate vertices you want in the resulting line. The higher the number the more dense and accurate the line will be.\n\nThe second argument is an optional object to declare options. The `offset` option controls the likelyhood that lines will be split which cross the dateline. The higher the number the more likely. The default value is 10, which means lines within 10 degress of the dateline will be split. For lines that cross and dateline and are also near the poles you will likely need a higher value to trigger splitting. It is unclear to me (@springmeyer) what the drawbacks are of high offsets. I simply ported the code from OGR's `gdal/ogr/ogrgeometryfactory.cpp` and have not taken the time to fully comprehend how it works.\n\n**4)** Convert line to GeoJSON geometry\n\nTo serialize to a GeoJSON geometry:\n\n```js\n> line.json();\n{ geometry:\n   { type: 'LineString',\n     coordinates: [ [Object], [Object], [Object], [Object], [Object], [Object] ] },\n  type: 'Feature',\n  properties: { name: 'Seattle to DC' } }\n```\n\nOr to WKT (Well known text):\n\n```js\n> line.wkt();\n'LINESTRING(-122 48,-112.061619 47.724167,-102.384043 46.608131,-93.227188 44.716217,-84.748239 42.144155,-77 38.999999)'\n```\n\nIt 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.\n","publish_time":1652127620857,"_cnpm_publish_time":1652127620857,"dist-tags":{"beta":"1.0.0-beta.1","latest":"1.0.0"}}