{"_id":"geojson-tools","_rev":"29-c79734cb00b515287cba96e4ae323e4b","name":"geojson-tools","description":"Tools for working with location data, using the GeoJSON specification","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"geojson-tools","version":"0.1.0","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.6.0"},"_id":"geojson-tools@0.1.0","dist":{"shasum":"50e1e40a2b2223c5956e80956a4dae3e9a8f2905","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.1.0.tgz","integrity":"sha512-foSNisb9uJOJvnpER8VBjdYAna/qA9UIw/rC1DtyUHdSuKbOSO/ya8Q8C1zDh8Pb5Hx3J5dvYG0Wo/hVBFc0aA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGlA9I3pNazGZIAf3FrdhpnePUdkCk9vOLK8hyMbgLEzAiEAraVsMnJV+zXSxjMDGHKmuPjSFDWd0g/LH6cdQfTkZxY="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}]},"0.1.3":{"name":"geojson-tools","version":"0.1.3","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.6.0"},"_id":"geojson-tools@0.1.3","dist":{"shasum":"749213353040ddc4598eed64689fbc1283b6296e","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.1.3.tgz","integrity":"sha512-6ujMET7Ibxid662LIOHOa1TLiDvvVGLFBoqriKbU3AZ886Nu7EOTwT6yXygEtnYVUAMt8zm//+IbuH6j/OxIuQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDb6cDACYgPZobtabJFB6fNLFO0OgM7VsIlxz8CtSWs1wIhAM98VMSH0e/mkNVKcMc1KyYIjai8RygB5u7I649P54/z"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}]},"0.1.4":{"name":"geojson-tools","version":"0.1.4","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.6.0"},"_id":"geojson-tools@0.1.4","dist":{"shasum":"e02beb69f96e2ba785b3f953f0ae5eea9fdd4238","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.1.4.tgz","integrity":"sha512-rZ4KZL3d0wtW/B1gDn4Xu0xCcLEmdpOPSSDU/pDezQ+b0/9bHYurYUmegaHUCkqPro8p72hicTdYmL6USOc8aA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+mHbZ5yRFvAWT8b/mDVQZO9oIGy4hed9l6QXHChxS+wIhAKHQYnvpSBh50asD6YzRAhwOgP/5WVA4c0FhgyLHOp9g"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}]},"0.1.5":{"name":"geojson-tools","version":"0.1.5","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.6.0"},"_id":"geojson-tools@0.1.5","dist":{"shasum":"b8a29053a4fcf839ffed9b360459f8a2dcca9de8","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.1.5.tgz","integrity":"sha512-js4BSjguQQofopyZ80s3GFNYHNbjAKw89sMMFbuWTGNl4dmMAHEls2j2LbIfuin2SriG/J7LUb7uuWch+xkUYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEkL64+CLvaXST3qSV83p2t7x/CyQcQzPm+N7d4/1/feAiBZmuknvaCy+7PmD7/4PukjUXe4lr38SythdzRpzilYyQ=="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}]},"0.1.6":{"name":"geojson-tools","version":"0.1.6","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.6.0"},"devDependencies":{"mocha":"1.18.*","chai":"~1.9.1"},"_id":"geojson-tools@0.1.6","_shasum":"0fe7362217cebc2e83256979deaa98593a7007b0","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}],"dist":{"shasum":"0fe7362217cebc2e83256979deaa98593a7007b0","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.1.6.tgz","integrity":"sha512-HSdeTOHz03SEiO67NuH8y4MO5l/+cKP8LZDi7nXSr7puSpmEniKNMnnmtP/+PzDPdMJGSijmIOcvTsEW7TbbLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAnA5L7r/sHGZiRVZ9hyxw9EecL0X7+RrtBUSafeWmdfAiEAzXjcJhwopU4+T8D6GrXGDKHckbiaBK677GH/IhCdgHc="}]}},"0.1.7":{"name":"geojson-tools","version":"0.1.7","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.6.0"},"devDependencies":{"mocha":"1.18.*","chai":"~1.9.1"},"_id":"geojson-tools@0.1.7","_shasum":"91a79d4b445185fbba9ac7f204cb47eddc1879e0","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}],"dist":{"shasum":"91a79d4b445185fbba9ac7f204cb47eddc1879e0","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.1.7.tgz","integrity":"sha512-pwq14E3oFEZalGW8OLHID7ifHUJnc6kVlayT4+NCiBZ3Fo18/CH8N7ueVv9rlpfJxWwtd4oTBI8hw2kFZO3jsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFrR6gjsfMa1gv7ts6GFEPG/aazgFSQnNwznFIPmy4WcAiBufA8ezlSitWVpJoii+XdYVAuEqXBjwz2Ei3FXRJ+K+A=="}]}},"0.2.0-pre":{"name":"geojson-tools","version":"0.2.0-pre","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.8.3"},"devDependencies":{"mocha":"2.2.*","chai":"2.1.*"},"gitHead":"dc86ba15df2cfaeafbe578cf87c2ee805191dc68","_id":"geojson-tools@0.2.0-pre","_shasum":"b23c0e0a8e9a5c7ed0ea55527d898b13e5ba3757","_from":".","_npmVersion":"2.8.3","_nodeVersion":"1.8.1","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"dist":{"shasum":"b23c0e0a8e9a5c7ed0ea55527d898b13e5ba3757","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.2.0-pre.tgz","integrity":"sha512-mez8G2Y/gOUfSYPC9cwFlt179oD76rYXkVn+UqsT+ruP4grM2wJhim02akl+W1+A6mdwGqWCw2fOFIpYKT8CtA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFzEDZTKw4XcP3KDuPAVbg0J0XyS5lrvyqBJcFsJm379AiEAuI44yYnz2yJqMe6UfXAQcU+xT4iH72I4mMRiL2HKoBk="}]},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}]},"0.2.0":{"name":"geojson-tools","version":"0.2.0","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.8.3"},"devDependencies":{"mocha":"2.2.*","chai":"2.1.*"},"gitHead":"35e951b9cc7c89a0a0111a6a7db5c435b5e78562","_id":"geojson-tools@0.2.0","_shasum":"4940c1be04b8ef58812c87a551cc2db7e4869ad7","_from":".","_npmVersion":"2.8.3","_nodeVersion":"1.8.1","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"dist":{"shasum":"4940c1be04b8ef58812c87a551cc2db7e4869ad7","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.2.0.tgz","integrity":"sha512-UMkz/3L5wQ8CmdAkEpwIThIkMuUcR+ySI/DuuLVN/IC9yKG7iIqnI+ICZx28s1gUxPY7MN2XXheuKjqajQ9Tcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEqzddS0kZSbPkbpDMCpH0OeaXrPoD/2akjHd/vs/v9lAiAX/4z+VC5OdshUiNuDLB/k34mtrweG8HqRfUTYkRKzww=="}]},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"}]},"0.2.1":{"name":"geojson-tools","version":"0.2.1","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.8.3"},"devDependencies":{"mocha":"2.2.*","chai":"2.1.*"},"gitHead":"d2ff5668368a684b28241c8ff966c3db655c816f","_id":"geojson-tools@0.2.1","_shasum":"08ecca52f5d11568397db3d9a2964f3bc49f17c3","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"dist":{"shasum":"08ecca52f5d11568397db3d9a2964f3bc49f17c3","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.2.1.tgz","integrity":"sha512-mEHJCa5CncTqR9DRriNbKo/xbcldSl96v1sCrCE1Kd83lyShfXm4dYE7mTZPdufVMAY2Bapx501LqbCMoevViA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAyKAjyNieaUpJQ2zNUPEQHjOSTPSNF+ZrgSoh942B/HAiEAuLNR1RygHL/T2cu/+RhAUOvXvGR0tKxeaoIBC7+STKQ="}]},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"},{"name":"nevi_me","email":"nevilledips@gmail.com"}]},"0.2.2":{"name":"geojson-tools","version":"0.2.2","description":"Tools for working with location data, using the GeoJSON specification","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/rwt-to/GeoJSON-Tools.git"},"keywords":["geojson"],"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","dependencies":{"underscore":"^1.8.3"},"devDependencies":{"mocha":"2.2.*","chai":"2.1.*"},"gitHead":"6e113b1bfb9b9b704404943e2fa3d97ff4dc8553","_id":"geojson-tools@0.2.2","_shasum":"b3d3db92e96e4910a839b273b61ad70a577cb3fb","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.7.1","_npmUser":{"name":"nevi-me","email":"nevilledips@gmail.com"},"dist":{"shasum":"b3d3db92e96e4910a839b273b61ad70a577cb3fb","tarball":"https://registry.npmjs.org/geojson-tools/-/geojson-tools-0.2.2.tgz","integrity":"sha512-Ao/LLkHfDGuZe1wthCc20yY0JEYdCtETlVSJTCZzYxThjCJHQ2FVt2Az5DnUvTcAo511v8EsicQpIDdMjxu1kA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGpSwIhOZfK/XkdAnlD+PKoszyFSfjUwdkB1sjU4SxurAiEAsEOYhvHQDLN8hDLzJWB8NzmalGMRt1Jq/B1pMSIifsI="}]},"maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"},{"name":"nevi_me","email":"nevilledips@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/geojson-tools-0.2.2.tgz_1461487786090_0.7496626016218215"}}},"readme":"# geojson-tools.js\r\n\r\nGeoJSON-Tools is a JavaScript module for working with location data, primarily using the GeoJSON specification.\r\n\r\nWe created GeoJSON-Tools from [rwt.to](//rwt.to) in order to use it on related projects that rely on GeoJSON (primarily for MongoDB's GeoJSON support).\r\n\r\nYou are welcome to use it, submit bug reports, add feature and pull requests!\r\n\r\n## Installation\r\n\r\nInstall [node.js](http://nodejs.org/), then:\r\n\r\n```sh\r\n$ npm install geojson-tools\r\n```\r\n\r\n## Documentation\r\n\r\n### Calculations\r\n\r\n* [getDistance](#getDistance)\r\n* [complexify](#complexify)\r\n\r\n### Conversions\r\n\r\n* [toGeoJSON](#toGeoJSON)\r\n* [toArray](#toArray)\r\n\r\n### Validations\r\n\r\n* [isGeoJSON](#isGeoJSON)\r\n\r\n## Calculations\r\n\r\n<a name=\"getDistance\" />\r\n### getDistance(array, decimals [optional])\r\n\r\nCalculates the distance of an array of locations.\r\n\r\n__Arguments__\r\n\r\n* array - an array of locations, in the format `[lat, lng]`.\r\n* decimals - the decimal points to round answer to, defaults to 3 decimal points.\r\n\r\n__Example__\r\n\r\n```js\r\nvar array = [\r\n    [20, 30],\r\n  [20.5, 29.5]\r\n];\r\ngetDistance(array, 4);\r\n\r\n// 76.321\r\n```\r\n\r\nTo get the distance between two points, pass two points in the array, to get the distance of a linestring, pass the coordinates of the linestring.\r\n\r\n<a name=\"complexify\" />\r\n### complexify(linestring, distance)\r\n\r\nConvert `LineString` or array of coordinates to a 'complex' line with specified maximum distance between each set of points.\r\n\r\n__Arguments__\r\n\r\n* linestring - a valid GeoJSON `LineString`, or an array of locations, in the format `[lat, lng]`.\r\n* distance - the maximum distance between each two locations, in meters. Minimum distance must be 10 meters.\r\n\r\n__Example__\r\n\r\n```js\r\nvar array = [\r\n    [20, 30],\r\n  [20.5, 29.5]\r\n];\r\ncomplexify(array, .5); // 500 meters\r\n\r\n/*\r\n[\r\n  [\r\n    20,\r\n    30\r\n  ],\r\n  [\r\n    20.01374457881841,\r\n    29.98625542118159\r\n  ],\r\n  [\r\n    20.02749358953798,\r\n    29.97250641046202\r\n  ],\r\n  [\r\n    20.04124228409795,\r\n    29.95875771590205\r\n  ],\r\n  [\r\n    20.054991756377518,\r\n    29.945008243622482\r\n  ],\r\n  [\r\n    20.068742346786582,\r\n    29.931257653213418\r\n  ],\r\n  [\r\n    20.082493595207826,\r\n    29.917506404792174\r\n  ],\r\n  [\r\n    20.09624419012715,\r\n    29.90375580987285\r\n  ],\r\n  [\r\n    20.109998454446686,\r\n    29.890001545553314\r\n  ],\r\n  [\r\n    20.1237529737179,\r\n    29.8762470262821\r\n  ],\r\n  [\r\n    20.13750307275061,\r\n    29.86249692724939\r\n  ],\r\n  [\r\n    20.151256033129513,\r\n    29.848743966870487\r\n  ],\r\n  [\r\n    20.165010879444292,\r\n    29.834989120555708\r\n  ],\r\n  [\r\n    20.17876504224938,\r\n    29.82123495775062\r\n  ],\r\n  [\r\n    20.192520769690717,\r\n    29.807479230309283\r\n  ],\r\n  [\r\n    20.206277898630216,\r\n    29.793722101369784\r\n  ],\r\n  [\r\n    20.22003390658687,\r\n    29.77996609341313\r\n  ],\r\n  [\r\n    20.233790231590877,\r\n    29.766209768409123\r\n  ],\r\n  [\r\n    20.247544863923423,\r\n    29.752455136076577\r\n  ],\r\n  [\r\n    20.261305062529242,\r\n    29.738694937470758\r\n  ],\r\n  [\r\n    20.275060711787024,\r\n    29.724939288212976\r\n  ],\r\n  [\r\n    20.288822447172574,\r\n    29.711177552827426\r\n  ],\r\n  [\r\n    20.3025819531983,\r\n    29.6974180468017\r\n  ],\r\n  [\r\n    20.3163428239271,\r\n    29.6836571760729\r\n  ],\r\n  [\r\n    20.330106243909288,\r\n    29.669893756090712\r\n  ],\r\n  [\r\n    20.34386828218919,\r\n    29.65613171781081\r\n  ],\r\n  [\r\n    20.357630509669633,\r\n    29.642369490330367\r\n  ],\r\n  [\r\n    20.37139577415928,\r\n    29.62860422584072\r\n  ],\r\n  [\r\n    20.385162033041937,\r\n    29.614837966958063\r\n  ],\r\n  [\r\n    20.398927945160654,\r\n    29.601072054839346\r\n  ],\r\n  [\r\n    20.412692053486403,\r\n    29.587307946513597\r\n  ],\r\n  [\r\n    20.426458446138625,\r\n    29.573541553861375\r\n  ],\r\n  [\r\n    20.4402208587639,\r\n    29.5597791412361\r\n  ],\r\n  [\r\n    20.45398897904669,\r\n    29.54601102095331\r\n  ],\r\n  [\r\n    20.467757803444808,\r\n    29.532242196555192\r\n  ],\r\n  [\r\n    20.481524285475142,\r\n    29.518475714524858\r\n  ],\r\n  [\r\n    20.49529252216346,\r\n    29.50470747783654\r\n  ],\r\n  [\r\n    20.5,\r\n    29.5\r\n  ]\r\n];\r\n*/\r\n\r\ndistance of 'simple' linestring: 76.321 km\r\ndistance of 'complex' linesting: 76.321 km\r\n```\r\n\r\n<b>Note:</b> The algorithms works relatively well, and will return results that are > 99.9% accurate over short distances. Specifying distances > 500 km might return undesireable results.\r\nWe have also not added the option to specify precision, and precision is set at the default rounding of 3 decimals, this is to avoid infinite loops.\r\n\r\n## Conversions\r\n\r\n<a name=\"toGeoJSON\" />\r\n### toGeoJSON(array, type)\r\n\r\nTakes an input of an array and a `GeoJSON` type, and returns that `GeoJSON` object.\r\n\r\n__Arguments__\r\n\r\n* array - an array of locations, in the format `[lat, lng]`.\r\n* type - the type of `GeoJSON` object to return (note that this is not case-sensitive).\r\nThe default type is 'Point', which is returned when pushing an array of a single set of coordinates.\r\nOther types are `LineString` and `Polygon`.\r\n\r\n<b>Note:</b> Other `GeoJSON` types will be supported in future versions.\r\n\r\n__Examples__\r\n\r\nTo convert to `GeoJSON::Point`\r\n\r\n_Note that the array can be shallow or nested, but has to contain only one set of coordinates._\r\n```js\r\nvar array = [[20, 30]];\r\ntoGeoJSON(array); // or toGeoJSON(array, 'point');\r\n\r\n// {\"type\":\"Point\",\"coordinates\":[30,20]}\r\n```\r\n\r\nTo convert to `GeoJSON::LineString`\r\n```js\r\nvar array = [\r\n  [20, 30],\r\n  [20.5, 29.5]\r\n];\r\ntoGeoJSON(array, 'linestring');\r\n\r\n// {\"type\":\"LineString\",\"coordinates\":[[30,20],[29.5,20.5]]}\r\n```\r\n\r\nTo convert to `GeoJSON::Polygon`\r\n\r\n_The minimum number of coordinates should be 4, and there is no need to add the last coordinate in the array.\r\n`Polygons` with holes are supported, however we currently do not test the validity of the holes._\r\n```js\r\nvar array = [\r\n  [20, 30],\r\n  [20.5, 29.5],\r\n  [21, 30.5]\r\n];\r\ntoGeoJSON(array, 'polygon');\r\n\r\n// {\"type\":\"Polygon\",\"coordinates\":[[[30,20],[29.5,20.5],[30.5,21],[30,20]]]}\r\n```\r\n\r\n<a name=\"toArray\" />\r\n### toArray(geoobj)\r\n\r\nTakes an input of a `GeoJSON` type, and returns coordinates in `[lat, lng]` format.\r\nA single set of coordinates for a `Point`, or an array for other types.\r\n\r\n__Arguments__\r\n\r\n* geoobj - a valid `GeoJSON` object of the following types: `Point`, `LineString`, `Polygon`, `MultiPoint`, `MultiLineString` or `MultiPolygon`.\r\n\r\n**Note:** The `Feature`, `FeatureCollection` and `GeometryCollection` objects are unsupported.\r\nThe logic being that it would make it difficult to work with such deeply nested arrays, and that the primary `GeoJSON` objects\r\nwould be mixed.\r\n\r\nTo convert the above to arrays, rather convert the individual geometries in the feature etc.\r\n\r\n__Examples__\r\n\r\nTo convert from `GeoJSON::Point`\r\n\r\n_Note that the array can be shallow or nested, but has to contain only one set of coordinates._\r\n```js\r\nvar geoobj = {\"type\":\"Point\",\"coordinates\":[30,20]};\r\ntoArray(geoobj);\r\n\r\n// [20,30]\r\n```\r\n\r\nTo convert from `GeoJSON::LineString`\r\n```js\r\nvar geoobj = {\"type\":\"LineString\",\"coordinates\":[[30,20],[29.5,20.5]]};\r\ntoArray(geoobj);\r\n\r\n// [[20,30],[20.5,29.5]]\r\n```\r\n\r\nTo convert from `GeoJSON::Polygon`\r\n\r\n_The minimum number of coordinates should be 3, and there is no need to add the last coordinate in the array._\r\n```js\r\nvar geoobj = {\"type\":\"Polygon\",\"coordinates\":[[[30,20],[29.5,20.5],[30.5,21],[30,20]]]};\r\ntoArray(geoobj);\r\n\r\n// [[20,30],[20.5,29.5],[21,30.5]]\r\n```\r\n## Validations\r\n\r\n<a name=\"isGeoJSON\" />\r\n### isGeoJSON(obj[, returnError])\r\n\r\nTakes an input of an object, and returns a `true` or `false`. Include a `Boolean` to return a validation message for invalid objects.\r\n\r\n__Arguments__\r\n\r\n* obj - an object, either valid or invalid `GeoJSON`.\r\n* returnError - a `Boolean` indicating whether to return a validation message if obj is invalid.\r\nThe default `returnError` is `true`.\r\n\r\n**Note:** All `GeoJSON` types are supported in the `isGeoJSON` check. They are:\r\n\r\n* `Point`\r\n* `MultiPoint`\r\n* `LineString`\r\n* `MultiLineString`\r\n* `Polygon`\r\n* `MultiPolygon`\r\n* `Feature`\r\n* `FeatureCollection`\r\n* `GeometryCollection`\r\n\r\nNested GeoJSON objects are validated as part of the supplied object.\r\n\r\n#### Caveats\r\n\r\n1. We currently do not check the order of `LinearRings` inside a `Polygon`\r\n2. All `coordinates` supplied are expected to be numbers, we do not `parseFloat`s\r\n3. Though the library expects users to be using WGS84, we do not check bounds of lat and lng\r\n\r\n__Examples__\r\n\r\nTo validate a valid `GeoJSON::Point`\r\n\r\n```js\r\nvar geoobj = {\"type\":\"Point\",\"coordinates\":[30,20]};\r\nisGeoJSON(geoobj, true);\r\n\r\n// true\r\n```\r\n\r\nTo validate an invalid `GeoJSON::LineString`\r\n```js\r\nvar geoobj = {\"type\":\"LineString\",\"coordinate\":[[30,20],[29.5,20.5]]};\r\n// note the 'coordinate', expecting 'coordinates'\r\nisGeoJSON(geoobj, true);\r\n\r\n// {result: false, message: \"invalid GeoJSON type supplied\"}\r\n```\r\n","maintainers":[{"name":"nevi-me","email":"nevilledips@gmail.com"},{"name":"nevi_me","email":"nevilledips@gmail.com"}],"time":{"modified":"2022-06-18T07:38:07.543Z","created":"2014-03-15T16:05:44.624Z","0.1.0":"2014-03-15T16:05:44.624Z","0.1.2":"2014-03-15T17:31:19.200Z","0.1.3":"2014-03-15T17:55:56.647Z","0.1.4":"2014-03-18T06:17:50.225Z","0.1.5":"2014-03-21T05:48:09.576Z","0.1.6":"2014-06-13T21:18:52.852Z","0.1.7":"2014-06-13T21:55:58.971Z","0.2.0-pre":"2015-06-02T16:41:42.361Z","0.2.0":"2015-06-02T16:42:55.514Z","0.2.1":"2015-06-03T04:49:09.929Z","0.2.2":"2016-04-24T08:49:48.370Z"},"homepage":"https://github.com/rwt-to/GeoJSON-Tools","keywords":["geojson"],"repository":{"type":"git","url":"git+https://github.com/rwt-to/GeoJSON-Tools.git"},"author":{"name":"Neville Dipale","email":"nevilledips@gmail.com"},"bugs":{"url":"https://github.com/rwt-to/GeoJSON-Tools/issues"},"license":"MIT","readmeFilename":"README.md","users":{"nevi-me":true,"mgenev":true,"vrutin":true,"maxfranzapps":true}}