{"name":"copc","version":"0.0.0","license":"UNLICENSED","_id":"copc@0.0.0","maintainers":[{"name":"connormanning","email":"connor@hobu.co"}],"dist":{"shasum":"30d950873d9c91590325309f6672399d2dff87d3","tarball":"http://registry-npm.ywwl.com/copc/download/copc-0.0.0.tgz","fileCount":7,"integrity":"sha512-NCak9MFOIUXmLSc3YWXpDFIPbdtPmaKQrW8t5bnqOf4Wrqioe+lVz1FjwYKfoQ/iDACZmU+SJk9+oXVCmKQuDA==","signatures":[{"sig":"MEUCIDxsPhASaD7BtLN0qJbM/gXoepiifBQYOBoQv7ZhPOKkAiEArFWRFZ9roDcf9PVCRSYNaywzODlOPC3zMVWfQJWG9tk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":979,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG9TOCRA9TVsSAnZWagAAaBEP/2Uc+ftmMuF+zGGv093A\nk8QzgVOmGwZ+SXn9kFS+arBQ1CAxf+MXYjbfRRP7w0UjmKDsFuASGoufk2JL\nFhiTwXUwDq9oe0qEjCR7t4BSS2meKq0guFD4aiuj4U9O7rRS8RjVj/K7mYJg\nwfnjxCAn89MiagOtAHBO339kehiTcr11ov+Q21RUmDk7PbpC+RT5TL5D542u\nJSDNez+SoaGo+EhQ7PoIafgpO9qvZFahP2Q6hKZ05FNWGQHuPPAP0yiepMHr\nEAofg+uscsWG3Ekkzg3QJJffVA2YIMIs3zW6MGk9myAI+YwPUe3ZAzKnxjUY\nq0CiECmVHs2nznx1bsTbT5Ub3oG7sM6iseivqW/SDFOIXDxZk2Ugapx1RDnw\nkpejIS3ua2bUCpd6b4OaydaX0FwwIeJsHMuPSatiPF9Rn9r31TkgKur9w1Tb\nbQgYghWHyGyThLOcP/Eu2o+2NtpP+PEpw5GOMeczD1DuymeRSO2HvDEhCnwm\nsL8HV+/lK4J7WYmoNjYpp42718qgJJjrhtbi5GmOC/wZZO4CNQdDD/KTecU9\naixJbvIVtMDbET6QcSOIA+xevcpZOgGkasx7ZIXH+SWtTdkR153fZ8YFOA0F\nkHqpGEN+vap7n3R6m1uZqik63a1bhcg7mwjOATATs+sRXKXWLSNb/RAOB3EI\nQJ3M\r\n=NyQv\r\n-----END PGP SIGNATURE-----\r\n","size":798,"noattachment":false,"key":"/copc/-/copc-0.0.0.tgz"},"main":"lib/index.js","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"scripts":{"test":"jest","build":"tsc","prepare":"yarn build"},"_npmUser":{"name":"connormanning","email":"connor@hobu.co"},"description":"![test](https://github.com/landrushing/template/workflows/test/badge.svg)","directories":{},"dependencies":{"node-fetch":"^2.6.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.0.6","husky":"^7.0.1","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/node-fetch":"^2.5.12"},"_npmOperationalInternal":{"tmp":"tmp/copc_0.0.0_1629213902281_0.48358618001268416","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":1629213902442,"_cnpm_publish_time":1629213902442,"dist-tags":{"latest":"0.0.9"}}