A Python tool that processes LAS/LAZ point cloud files and generates a shapefile containing the bounding boxes of each file. This is useful for creating spatial indexes, visualizing point cloud coverage, or performing spatial queries on large collections of point cloud data.
- ✅ Processes both
.lasand.lazfiles - ✅ Generates ESRI Shapefile with bounding box polygons
- ✅ Includes metadata (filename, coordinates, point count)
- ✅ Progress bar for batch processing
- ✅ Command-line interface with flexible options
- ✅ Error handling for corrupted files
- ✅ Customizable coordinate reference system
- Python 3.7 or higher
- pip package manager
- Clone or download this repository
- Navigate to the project directory
- Install required packages:
pip install -r requirements.txtYou can also install dependencies individually:
pip install laspy fiona tqdmBasic usage:
python main.py /path/to/your/pointcloud/folderWith custom output folder:
python main.py /path/to/input/folder -o /path/to/output/folderWith custom coordinate reference system:
python main.py /path/to/input/folder --crs EPSG:3857input_folder: Path to folder containing .las/.laz files (required)-o, --output: Custom output folder path (optional)--crs: Coordinate reference system for output shapefile (default: EPSG:4326)-h, --help: Show help message
# Process point clouds in the 'data' folder
python main.py ./data
# Process with custom output location
python main.py ./data -o ./results
# Process with UTM Zone 33N coordinate system
python main.py ./data --crs EPSG:32633The script creates:
- Output folder:
PointCloud_laz_BBOX(or custom folder if specified) - Shapefile:
PointCloud_laz_BBOX_{folder_name}.shpwith associated files (.shx, .dbf, .prj)
Each polygon feature contains the following attributes:
| Field | Type | Description |
|---|---|---|
filename |
String | Original LAS/LAZ filename |
x_min |
Float | Minimum X coordinate |
x_max |
Float | Maximum X coordinate |
y_min |
Float | Minimum Y coordinate |
y_max |
Float | Maximum Y coordinate |
points |
Integer | Number of points in the file |
pointcloud-bbox-generator/
├── main.py # Main script
├── requirements.txt # Python dependencies
└── README.md # This file
- laspy: Reading LAS/LAZ point cloud files
- fiona: Writing ESRI Shapefiles
- tqdm: Progress bars for batch processing
.las- LAS point cloud files.laz- Compressed LAZ point cloud files
.shp- ESRI Shapefile format (with .shx, .dbf, .prj files)
- Missing dependencies: Clear error messages with installation instructions
- Invalid folder paths: FileNotFoundError with helpful message
- No point cloud files: ValueError if no .las/.laz files found
- Corrupted files: Individual file errors are logged as warnings, processing continues
- Permission errors: Handled gracefully with informative messages
- Processing time depends on the number of files and file sizes
- Large collections (1000+ files) may take several minutes
- Memory usage is minimal as only headers are read
- Progress bar shows real-time processing status
- Import Error: Install missing dependencies with
pip install -r requirements.txt - Permission Denied: Ensure write permissions for output folder
- No Files Found: Check that folder contains .las or .laz files
- Coordinate System Issues: Verify CRS code is valid (e.g., EPSG:4326)
If you encounter issues:
- Check that all dependencies are installed
- Verify input folder contains point cloud files
- Ensure you have write permissions for the output location
- Check the console output for specific error messages
This project is released under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
- Initial release
- Support for LAS/LAZ files
- ESRI Shapefile output
- Command-line interface
- Progress tracking
- Error handling