{"_id":"detect-coordinates","_rev":"112-1a86406d025eba55d45fab1c5d42282e","name":"detect-coordinates","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"detect-coordinates","version":"0.1.0","author":{"name":"Thomas Rueckstiess","email":"thomas@rueckstiess.net"},"license":"Apache-2.0","_id":"detect-coordinates@0.1.0","maintainers":[{"name":"rueckstiess","email":"thomas@rueckstiess.net"}],"homepage":"http://github.com/mongodb-js/detect-coordinates","bugs":{"url":"https://github.com/mongodb-js/detect-coordinates/issues"},"dist":{"shasum":"b17594b6d875ce4f6d8b54ae4a31e80d9d787fbe","tarball":"https://registry.npmjs.org/detect-coordinates/-/detect-coordinates-0.1.0.tgz","integrity":"sha512-6LHpaPzvcOySQcKDf2xUbgCV8olU0X6cnKFW24W5HAQYmrmWZR8p/BcHUjzZEtqqrScBucWBowE8QQm+zUoWdQ==","signatures":[{"sig":"MEQCIFxxEbTWvCOM5kBuHTG/WyqB3XQ5EPqw0mXgdLJapPocAiA0uedHXj4c4gvCsNGJme2mE80QF8ix5jwvYrZoBXq4lQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"b17594b6d875ce4f6d8b54ae4a31e80d9d787fbe","gitHead":"e5c3aaf4f126aac6e0e0785c6a46afa12bda11de","scripts":{"ci":"npm run check && npm test","fmt":"mongodb-js-fmt","test":"mocha","check":"mongodb-js-precommit"},"_npmUser":{"name":"rueckstiess","email":"thomas@rueckstiess.net"},"precommit":["check"],"repository":{"url":"git://github.com/mongodb-js/detect-coordinates.git","type":"git"},"_npmVersion":"3.6.0","description":"Geo coordinates detection based of a mongodb-schema type.","directories":{},"_nodeVersion":"5.7.0","dependencies":{"lodash":"^4.13.1"},"devDependencies":{"mocha":"^2.3.4","pre-commit":"^1.1.2","mongodb-js-fmt":"^0.0.3","mongodb-js-precommit":"^0.2.8","eslint-config-mongodb-js":"^1.0.6"},"_npmOperationalInternal":{"tmp":"tmp/detect-coordinates-0.1.0.tgz_1465370506345_0.28257105057127774","host":"packages-16-east.internal.npmjs.com"}},"0.2.0":{"name":"detect-coordinates","version":"0.2.0","author":{"name":"Thomas Rueckstiess","email":"thomas@rueckstiess.net"},"license":"Apache-2.0","_id":"detect-coordinates@0.2.0","maintainers":[{"name":"rueckstiess","email":"thomas@rueckstiess.net"}],"homepage":"http://github.com/mongodb-js/detect-coordinates","bugs":{"url":"https://github.com/mongodb-js/detect-coordinates/issues"},"dist":{"shasum":"890d5ba0c55f8fba5504e221a7734b016154628a","tarball":"https://registry.npmjs.org/detect-coordinates/-/detect-coordinates-0.2.0.tgz","integrity":"sha512-BAywV3B1BY1G7eEuPyGE4A+Waykq3HuEWYTyVy3bgS0oyfLsihc6pRgpjhe3ujjzQmH2iJItd/617ILAZyIxyA==","signatures":[{"sig":"MEQCIDwnynMx+uRAbPwjNKiwaQo5c33M82g02fQoATnZBwzKAiBJ3nHXDASMS2/MWNWL3kuQ33oMQgZoEgusJZ9FbALmOg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"890d5ba0c55f8fba5504e221a7734b016154628a","gitHead":"d0c29d926a9568f1e0cf78de2e0bf3bccd1a2373","scripts":{"ci":"npm run check && npm test","fmt":"mongodb-js-fmt","test":"mocha","check":"mongodb-js-precommit"},"_npmUser":{"name":"rueckstiess","email":"thomas@rueckstiess.net"},"precommit":["check"],"repository":{"url":"git://github.com/mongodb-js/detect-coordinates.git","type":"git"},"_npmVersion":"3.10.3","description":"Geo coordinates detection based of a mongodb-schema type.","directories":{},"_nodeVersion":"6.3.1","dependencies":{"lodash":"^4.13.1"},"devDependencies":{"mocha":"^3.1.2","pre-commit":"^1.1.2","mongodb-js-fmt":"^0.0.3","mongodb-js-precommit":"^0.2.8","eslint-config-mongodb-js":"^2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/detect-coordinates-0.2.0.tgz_1478938400812_0.4974369090050459","host":"packages-12-west.internal.npmjs.com"}}},"time":{"created":"2016-06-08T07:21:49.540Z","modified":"2026-07-15T15:34:47.761Z","0.1.0":"2016-06-08T07:21:49.540Z","0.2.0":"2016-11-12T08:13:21.045Z"},"bugs":{"url":"https://github.com/mongodb-js/detect-coordinates/issues"},"author":{"name":"Thomas Rueckstiess","email":"thomas@rueckstiess.net"},"license":"Apache-2.0","homepage":"http://github.com/mongodb-js/detect-coordinates","repository":{"url":"git://github.com/mongodb-js/detect-coordinates.git","type":"git"},"description":"Geo coordinates detection based of a mongodb-schema type.","maintainers":[{"email":"satya@mongodb.com","name":"satyasinha"},{"email":"kristina.stefanova@mongodb.com","name":"kristina.stefano"},{"email":"nathan.smyth@10gen.com","name":"jarjee"},{"email":"iteng@mongodb.com","name":"devtoolsbot"},{"email":"james.wang@mongodb.com","name":"mongo-j"},{"email":"neal.beeken@mongodb.com","name":"nbbeeken"},{"email":"dbx-node@mongodb.com","name":"dbx-node"},{"email":"devtools-npm-user@mongodb.com","name":"devtools-npm-user"},{"email":"me@tomr.au","name":"rueckstiess"}],"readme":"# detect-coordinates [![travis][travis_img]][travis_url] [![npm][npm_img]][npm_url]\n\n> Geo coordinates detection based on a mongodb-schema type.\n\nThis module exports a function which detects whether a [mongodb-schema][mongodb-schema]\ntype object represents geo coordinates, either as legacy coordinate pairs\n(2-element array of long/lat coordinates) or a GeoJSON object.\n\nIt returns a zipped array of `[[lng, lat], [lng, lat], ...]` coordinates, or\n`false` if no coordinates could be found.\n\n## Example\n\nFor this example, you need the `mongodb` node driver, `mongodb-schema` and\n`lodash` modules installed in addition to this module:\n\n```\nnpm install mongodb mongodb-schema detect-coordinates lodash\n```\n\nThis code connects to a MongoDB server, gets the schema of a collection\nand looks at the first type of the first field to determine if it has\ncoordinates.\n\n```javascript\nvar parseSchema = require('mongodb-schema');\nvar connect = require('mongodb');\nvar detect = require('detect-coordinates');\nvar _ = require('lodash');\n\n// connect to a MongoDB instance\nconnect('mongodb://localhost:27017/test', function(err, db){\n  if(err) return console.error(err);\n\n  // get the schema of the collection `test.users` (only first 100 docs)\n  parseSchema('test.users', db.collection('users').find().limit(100), function(err, schema){\n    if(err) return console.error(err);\n\n    // serialize the schema and extract first type of field \"last_position\"\n    var plainSchema = schema.serialize();\n    var type = _.find(plainSchema.fields, ['name', 'last_position']).types[0];\n\n    // check if that type represents geo coordinates\n    var coordinates = detect(type);\n    if (coordinates) {\n      console.log('type contains coordinates, here they are:\\n', coordinates);\n    } else {\n      console.log('type does not contain coordinates!');\n    }\n    db.close();\n  });\n});\n```\n\nThis outputs:\n\n```\ntype contains coordinates, here they are:\n[ [ -73.98808416, 40.74854862 ],\n  [ -74.015756, 40.711512 ],\n  [ -74.0026376103, 40.7390169121 ],\n  [ -74.015756, 40.711512 ],\n  [ -73.96525063, 40.71044554 ],\n  ...\n```\n\n## License\n\nApache 2.0\n\n[mongodb-schema]: https://github.com/mongodb-js/mongodb-schema\n[travis_img]: https://img.shields.io/travis/mongodb-js/detect-coordinates.svg\n[travis_url]: https://travis-ci.org/mongodb-js/detect-coordinates\n[npm_img]: https://img.shields.io/npm/v/detect-coordinates.svg\n[npm_url]: https://npmjs.org/package/detect-coordinates\n","readmeFilename":"README.md"}