{"name":"copc","version":"0.0.8","license":"MIT","_id":"copc@0.0.8","maintainers":[{"name":"connormanning","email":"connor@hobu.co"}],"dist":{"shasum":"10ed04ad5185709a0d1800cffc4d49da44772357","tarball":"http://registry-npm.ywwl.com/copc/download/copc-0.0.8.tgz","fileCount":102,"integrity":"sha512-OWjfOZKhh7EkSYIMST/yxmegMwCR5Gye3Koq3ov1+oHFozBbPwlK1bsSWB9aNdJrXElaTh374bNhOSPxx1xSog==","signatures":[{"sig":"MEUCIAo+GbQGQiN38rseHLfcIzyLG0DWfLx3WBRfcKnJNvbKAiEA+x1L31RU5qJy3ypWYB9BmdES8TBRmfMlf6eLPmvQoxo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90749,"size":21189,"noattachment":false,"key":"/copc/-/copc-0.0.8.tgz"},"main":"lib/index.js","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"types":"./lib/index.d.ts","browser":{"fs":false},"gitHead":"d95d5a85869c54121ecc568afb4298a1b6650d2d","scripts":{"test":"jest","build":"tsc --project tsconfig.production.json && tsc-alias","prepare":"npm run build"},"_npmUser":{"name":"connormanning","email":"connor@hobu.co"},"_npmVersion":"11.0.0","description":"![test](https://github.com/connormanning/copc/workflows/test/badge.svg)","directories":{},"_nodeVersion":"22.12.0","dependencies":{"laz-perf":"^0.0.7","cross-fetch":"^3.1.5"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","husky":"^7.0.1","ts-jest":"^29.1.1","prettier":"^3.0.3","tsc-alias":"^1.8.8","typescript":"^5.2.2","@types/jest":"^29.5.7","@types/node":"^20.8.10","pretty-quick":"^3.1.3","@types/estree":"^1.0.4","@types/emscripten":"^1.39.10"},"_npmOperationalInternal":{"tmp":"tmp/copc_0.0.8_1739929412862_0.19423884260764157","host":"s3://npm-registry-packages-npm-production"},"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":1739929413046,"_cnpm_publish_time":1739929413046,"dist-tags":{"latest":"0.0.9"}}