{"name":"copc","version":"0.0.1","license":"UNLICENSED","_id":"copc@0.0.1","maintainers":[{"name":"connormanning","email":"connor@hobu.co"}],"dist":{"shasum":"3af107c33ca99c02f457cc450eae0a9e8503e523","tarball":"http://registry-npm.ywwl.com/copc/download/copc-0.0.1.tgz","fileCount":77,"integrity":"sha512-mEyPwaeocdIh/jnZTm1HoP4DU7v+w1qbgZVB4seJWwhBZ2fxmkYdQ7DJb/WuoX92sqpu7YhFf9YhWh/gxpwJjg==","signatures":[{"sig":"MEQCIE/jZegl0QohGldac+dmQX8u07q49PYxg2CroJJ88TEqAiBOvTGbBmxmjQcshT+Ai6oZ1DPg9pZAQTqTPlr1RkZApw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":46942,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhI8jxCRA9TVsSAnZWagAA1YAP/jPOco09R+cPME4cj9+q\ncqHhq1RKbJRz48ITXcUi6hlyTC8TnlvruUgdtsR+hGa3BXLNcEcInA4AZGzr\nJi2ALNfeJ/hQKgq4DXSMRYVyuI7pHvaA2NjdA55ZaJkH8cu3MlhrAwvMreFT\nEGJ6+NbDTFKYmz0UmlXqyKZHnPao63lHRKlsGRXepa9hhEl/KmqLhQ1ifhV+\nZONOVZTHA5w8lsXPCg8cwg34v1Qg3JUfpzYduNZKoY7SjwvbcpKh+o7xg7Lq\nfX7FjLfD7i9nJ5jrLpip9DFPiq+gHPya5zPRjmCn/P6FVzoC+ZyapCT22WmH\n3BFeZtpoPptwF5TdjwxkuqHts9JBiakfijdiqJzY0bG3iPNhbKrqqGH/CZlr\nsMzcM8TKvdT/QoaFaTFBVVn6RNa8MJz0Q+NxFulqL9HnxcyzGvbJUy2yXuSP\noMA4XzRksN516zpJLxlTNLbBv3uNtX0o1Ej0t+LlcWL30T5bGqpasmQlEWW0\njWJuaS+AumQF1mMYXP9IYVakM0KPxq2INWtEiWhzEZJg1TZeFMWUFl7XpVkN\n7aL3Euf9YahAeqWukVKuPXtjGQoNxS8u6LLL3uTePaABjIw8zJnQXJR6WBSH\nQX/UIzsH8XMioJ89DNM/38oMf0632pSW5QvYkJtDWDSKwTr8XCnQi2BERLD2\nJ4ku\r\n=4fcq\r\n-----END PGP SIGNATURE-----\r\n","size":11494,"noattachment":false,"key":"/copc/-/copc-0.0.1.tgz"},"main":"lib/index.js","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"test":"jest","build":"tsc --project tsconfig.production.json","prepare":"yarn build"},"_npmUser":{"name":"connormanning","email":"connor@hobu.co"},"description":"![test](https://github.com/connormanning/copc/workflows/test/badge.svg)","directories":{},"dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.0.6","husky":"^7.0.1","forager":"^0.0.8","ts-jest":"^27.0.5","ts-node":"^10.2.0","prettier":"^2.3.2","typescript":"^4.3.5","@types/jest":"^27.0.1","@types/node":"^16.6.1","pretty-quick":"^3.1.1","@types/emscripten":"^1.39.5","@types/node-fetch":"^2.5.12"},"_npmOperationalInternal":{"tmp":"tmp/copc_0.0.1_1629735153838_0.17196932942359022","host":"s3://npm-registry-packages"},"readme":"# COPC\n![test](https://github.com/connormanning/copc/workflows/test/badge.svg)\n\nA TypeScript library for reading and parsing [COPC](https://copc.io/) data.\n\n`npm install copc`\n\n## Usage\n\n### Initialize a COPC object\n```typescript\n// Can also pass a getter instead of a filename string.\nconst copc = await Copc.create(filename)\nconsole.log(copc)\n```\n```\n{\n  header: {\n    fileSignature: 'LASF',\n    fileSourceId: 0,\n    globalEncoding: 16,\n    projectId: '00000000-0000-0000-0000000000000000',\n    majorVersion: 1,\n    minorVersion: 4,\n    systemIdentifier: '',\n    generatingSoftware: '',\n    fileCreationDayOfYear: 1,\n    fileCreationYear: 1,\n    headerLength: 375,\n    pointDataOffset: 1424,\n    vlrCount: 3,\n    pointDataRecordFormat: 7,\n    pointDataRecordLength: 36,\n    pointCount: 100000,\n    pointCountByReturn: [\n      50002, 49998, 0, 0,\n          0,     0, 0, 0,\n          0,     0, 0, 0,\n          0,     0, 0\n    ],\n    scale: [ 0.01, 0.01, 0.01 ],\n    offset: [ -8242596, 4966606, 0 ],\n    min: [ -8242746, 4966506, -50 ],\n    max: [ -8242446, 4966706, 50 ],\n    waveformDataOffset: 0,\n    evlrOffset: 630520,\n    evlrCount: 1\n  },\n  vlrs: [\n    {\n      userId: 'copc',\n      recordId: 1,\n      contentOffset: 429,\n      contentLength: 160,\n      description: 'COPC info VLR',\n      isExtended: false\n    },\n    {\n      userId: 'laszip encoded',\n      recordId: 22204,\n      contentOffset: 643,\n      contentLength: 46,\n      description: 'lazperf variant',\n      isExtended: false\n    },\n    {\n      userId: 'LASF_Projection',\n      recordId: 2112,\n      contentOffset: 743,\n      contentLength: 681,\n      description: '',\n      isExtended: false\n    },\n    {\n      userId: 'copc',\n      recordId: 1000,\n      contentOffset: 630580,\n      contentLength: 160,\n      description: 'COPC Hierarchy',\n      isExtended: true\n    }\n  ],\n  info: {\n    cube: [ -8242746, 4966506, -50, -8242446, 4966806, 250 ],\n    spacing: 2.34375,\n    rootHierarchyPage: { pageOffset: 630580, pageLength: 160 },\n    gpsTimeRange: [ 42, 42 ]\n  },\n  wkt: 'PROJCS[\"WGS 84 / Pseudo-Mercator\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Mercator_1SP\"],PARAMETER[\"central_meridian\",0],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],EXTENSION[\"PROJ4\",\"+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs\"],AUTHORITY[\"EPSG\",\"3857\"]]',\n  eb: []\n}\n```\n\n### Traverse hierarchy and read point data\n```typescript\nconst { nodes, pages } = await Copc.loadHierarchyPage(\n  filename,\n  copc.info.rootHierarchyPage\n)\nconst root = nodes['0-0-0-0']!\nconst view = await Copc.loadPointDataView(filename, copc, root)\nconsole.log('Dimensions:', view.dimensions)\n\nconst getters = ['X', 'Y', 'Z', 'Intensity'].map(view.getter)\nfunction getXyzi(index: number) {\n  return getters.map(get => get(index))\n}\nconst point = getXyzi(0)\nconsole.log('Point:', point)\n```\n```\nDimensions: {\n  X: { type: 'float', size: 8 },\n  Y: { type: 'float', size: 8 },\n  Z: { type: 'float', size: 8 },\n  Intensity: { type: 'unsigned', size: 2 },\n  ReturnNumber: { type: 'unsigned', size: 1 },\n  NumberOfReturns: { type: 'unsigned', size: 1 },\n  Synthetic: { type: 'unsigned', size: 1 },\n  KeyPoint: { type: 'unsigned', size: 1 },\n  Withheld: { type: 'unsigned', size: 1 },\n  Overlap: { type: 'unsigned', size: 1 },\n  ScannerChannel: { type: 'unsigned', size: 1 },\n  ScanDirectionFlag: { type: 'unsigned', size: 1 },\n  EdgeOfFlightLine: { type: 'unsigned', size: 1 },\n  Classification: { type: 'unsigned', size: 1 },\n  UserData: { type: 'unsigned', size: 1 },\n  ScanAngle: { type: 'float', size: 4 },\n  PointSourceId: { type: 'unsigned', size: 2 },\n  GpsTime: { type: 'float', size: 8 },\n  Red: { type: 'unsigned', size: 2 },\n  Green: { type: 'unsigned', size: 2 },\n  Blue: { type: 'unsigned', size: 2 }\n}\nPoint: [-8242596, 4966706, 50, 128]\n```\n","publish_time":1629735153972,"_cnpm_publish_time":1629735153972,"dist-tags":{"latest":"0.0.9"}}