{"id":18248,"library":"copc","title":"COPC","description":"A TypeScript library for reading and parsing Cloud Optimized Point Cloud (COPC) data, version 0.0.8. It provides utilities to initialize a COPC object from a file or getter, traverse the hierarchy pages, and read point data views with typed dimension access. The library is pre-1.0 and actively maintained on GitHub with CI. It differentiates from other point cloud libraries by focusing specifically on the COPC format, offering a simple async API, and shipping TypeScript types.","status":"active","version":"0.0.8","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install copc","lang":"bash","label":"npm"},{"cmd":"yarn add copc","lang":"bash","label":"yarn"},{"cmd":"pnpm add copc","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; CommonJS require will not work. Use named import.","wrong":"const copc = require('copc')","symbol":"Copc","correct":"import { Copc } from 'copc'"},{"note":"Node is only a TypeScript type, cannot be used as a value.","wrong":"import { Node } from 'copc'","symbol":"Node","correct":"import type { Node } from 'copc'"},{"note":"CopcHeader is a separate exported type, not a member of Copc class.","wrong":"import { Copc } from 'copc' and access Copc.Header","symbol":"CopcHeader","correct":"import type { CopcHeader } from 'copc'"}],"quickstart":{"code":"import { Copc } from 'copc';\n\nasync function main() {\n  const filename = 'path/to/file.copc.laz';\n  const copc = await Copc.create(filename);\n  console.log('Header:', copc.header);\n  console.log('Info:', copc.info);\n  \n  const { nodes } = await Copc.loadHierarchyPage(filename, copc.info.rootHierarchyPage);\n  const root = nodes['0-0-0-0'];\n  if (root) {\n    const view = await Copc.loadPointDataView(filename, copc, root);\n    console.log('Dimensions:', view.dimensions);\n    const getX = view.getter('X');\n    const getY = view.getter('Y');\n    const getZ = view.getter('Z');\n    const x = getX(0);\n    const y = getY(0);\n    const z = getZ(0);\n    console.log(`Point 0: (${x}, ${y}, ${z})`);\n  }\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Shows how to initialize a Copc object, load the root hierarchy page, and read point data using dimension getters."},"warnings":[{"fix":"Pin to a specific version and test after upgrades.","message":"Version 0.x may have breaking changes between minor versions. The API is not stable.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Provide a custom async getter function that returns ArrayBuffer for given byte offset and length.","message":"The library requires a file path or getter, not a URL. For remote files, you must implement a getter that fetches byte ranges.","severity":"gotcha","affected_versions":"*"},{"fix":"Watch the GitHub repository for changelog.","message":"As of v0.0.8, no deprecations are known. However, pre-1.0 releases may deprecate features without notice.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install copc and ensure your project is set up for ESM (e.g., \"type\": \"module\" in package.json).","cause":"Missing npm install or ESM import syntax not transpiled.","error":"Error: Could not find module 'copc'"},{"fix":"Replace 'const Copc = require(\"copc\")' with 'import { Copc } from \"copc\"'.","cause":"Using CommonJS require instead of ESM import.","error":"TypeError: Copc.create is not a constructor"},{"fix":"Import as a type: 'import type { CopcHeader } from \"copc\"'.","cause":"Trying to use CopcHeader as a value, but it is only a type.","error":"Cannot find name 'CopcHeader'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}