{"name":"copc","version":"0.0.2","license":"UNLICENSED","_id":"copc@0.0.2","maintainers":[{"name":"connormanning","email":"connor@hobu.co"}],"dist":{"shasum":"a858b0052348b37193d66204966428ee33fdc52f","tarball":"http://registry-npm.ywwl.com/copc/download/copc-0.0.2.tgz","fileCount":77,"integrity":"sha512-ryIS5w8YDzpDs/N2pC1FzkgwBoqGMqqWqXqPQZq2XvbSf3+1j2CmcLaQPCuUEQovdWghE8oR0KhbvaQb+ZteDA==","signatures":[{"sig":"MEUCIQDg13OGrEnDuHBM9FOkJIlII9tKglJHcwlpg63IMkRkUQIgVqu8mwfxWrGJd2IqiC1lw+xtzjaBoXE9RZvAyeiF4Bk=","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\nwsFcBAEBCAAQBQJhI8kvCRA9TVsSAnZWagAAjL8P/1w3FYsXTy3BPOY122U5\n1hRH7TT3UKqwYg0EVcptA0RL7JcX01r8uF+RqszsWB1hSRnOFrFsfjFgfqJ3\nVII+p1+z7moYH0gwt/wp/Sk3+U7L0sJfHTv2KhY3MMq6XC+kK2FRfelOMbYf\nw+paBTsBzaHc9HbKarEzOz39GhjGH6nsMkaEt+AO80OrWIxmjFdOqIjN/qXW\nd8gLVGyIS4AcJ2IF1xjzrQyEf2DbGmPvOyIwlIPhbRto2COAMUwAiIN+2O3L\nuoraSduSmooZDL2TnLEsv0KISoWCyOBRfLNjbgM25oPr5Aefprkh8zblhfS6\n+3YA8X3Yo7wEY9+VjXkwdZL7L/7An1uHkyKXeXMU1RJjOSQ05zaIx7ij+umT\ndPxELd+5kqtJMI8Y2vW8oF89dcEKU85+ulz8UD1dSr4uZ4NViZSHUJtaOIPF\nrhhY0gOFJQgcArCPBJdWbrg5xUxZe+FldBzwLyXqCd/YxNBqaaRElEicxAtp\n6xEr1aqnR2Y1YdimwbtyTbM4LS9sWlpFB+zaEQos1/jkSPD82120yx/lRXHj\n3+bTURGPTAvnW/Oq1fFXXki76OvkMMrjhn3Sut6uQlEt33H95Nk8ONURhxlU\nUDZXooeYV7bmw9RXnaRS56ksacwL+NHlJicBlK1gRknvVmC5gC8KvvJ1ZA2S\nttnG\r\n=1P4X\r\n-----END PGP SIGNATURE-----\r\n","size":11494,"noattachment":false,"key":"/copc/-/copc-0.0.2.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.2_1629735215739_0.47157130248944523","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":1629735215907,"_cnpm_publish_time":1629735215907,"dist-tags":{"latest":"0.0.9"}}