Skip to main content

Building Footrprint Extraction from Aerial LiDAR data

Project description

This Python package is BUilding Footprint Extractor Test

This of example of an how you can run your code

import LasBuildSeg as lasb
import numpy as np

# Define input parameters
input_laz = '<input>.laz'  # Path to the input laz/las data file
epsg_code = <epsg_code>  # EPSG code of the input laz data
multy = <DTM non-ground multipalction number>  # Multiplication factor for DSM height enhancement
intermethod = '<interpolation method>'  # Interpolation method ('cubic', 'nearest', or 'linear')

# Define default parameter values
constant = 3.6  # Adaptive threshold constant
block_size = 51  # Adaptive threshold block size
kernel_size = 3  # Morphological open kernel size
tri_threshold = 3  # Terrain Ruggedness Index threshold

# Define contour filtering parameters
min_size = 35
max_size = 5000
squareness_threshold = 0.3
width_threshold = 3
height_threshold = 3
CloseKernel_size = 15

# Generate DSM and DTM
lasb.generate_dsm(input_laz, epsg_code, intermethod)
lasb.generate_dtm(input_laz, epsg_code, intermethod, multy)

# Generate NDHM
lasb.generate_ndhm('dtm.tif', 'dsm.tif')

# Read NDHM image and profile
img, profile = lasb.read_geotiff('ndhm.tif')

# Transform DSM
lasb.DSM_transform('dsm.tif')

# Read transformed DSM and profile
dem, _ = lasb.read_geotiff('dsm3857.tif')

# Convert image to 8-bit
img_8bit = lasb.to_8bit(img)

# Apply adaptive thresholding
img_thresh = lasb.threshold(img_8bit, block_size, constant)

# Apply morphological opening
img_open = lasb.morph_open(img_thresh, kernel_size)

# Filter contours without TRI
building_mask=lasb.filter_contours(img_open, dem, profile, min_size, max_size, squareness_threshold, width_threshold, height_threshold, tri_threshold)

# Apply morphological closing
building_mask_closed = lasb.close(building_mask, CloseKernel_size)

# Write building mask to GeoTIFF
lasb.write_geotiff('buildings.tif', building_mask_closed, profile)

# Convert building mask to GeoJSON
lasb.building_footprints_to_geojson('buildings.tif', 'building.geojson')

# Print completion message
print('All steps are complete.')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lasbuildseg-0.2.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lasbuildseg-0.2.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file lasbuildseg-0.2.0.tar.gz.

File metadata

  • Download URL: lasbuildseg-0.2.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for lasbuildseg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f6715d7cd84ce8fbf8e7a009d1c66ea21d959c0c09a4feb847db9b089ab22d13
MD5 d3cb0c5a35a702c13ccdf290a048f081
BLAKE2b-256 cf4bb55265a26d3ab3008f29d8a28bb3e0d56f3f013fddb8d7a1dbcd2f1f13d3

See more details on using hashes here.

File details

Details for the file lasbuildseg-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: lasbuildseg-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for lasbuildseg-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02554c43ed7e1bfc27104694b4f15848af825c030aabc16afd2da29ead63c7de
MD5 b6134a1ad2d0ec3587b11d7c448857b0
BLAKE2b-256 5bb719d0541a9da36f4b3232332ce31af3180eecdbb20d8431419e65cee2ccaa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page