Lidar
Classified point-cloud heights and vegetation clearance around power lines
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/lidar/index.md to help me query Lidar with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Measure point heights above the ground
Uses the connector’s bundled synthetic point cloud and sample site geometry.
Example output · captured
- Connector release
- v0.3.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))) SELECT feature_id, round(building_p95_m, 1), canopy_max_m
FROM lidar.main.height_metrics((SELECT * FROM site))
ORDER BY feature_id
| feature_id | round(building_p95_m, 1) | canopy_max_m |
|---|---|---|
| site | 11.9 | 18 |
Quick start
Choose where to run Lidar, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'lidar' AS lidar (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-lidar-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'lidar' AS lidar (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-lidar:0.3.0'
);
3. Run a query
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))) SELECT feature_id, round(building_p95_m, 1), canopy_max_m
FROM lidar.main.height_metrics((SELECT * FROM site))
ORDER BY feature_id
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'lidar' AS lidar
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))) SELECT feature_id, round(building_p95_m, 1), canopy_max_m
FROM lidar.main.height_metrics((SELECT * FROM site))
ORDER BY feature_id
Query Farm operates Lidar for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use lidar as the catalog alias for the query below.
4. Run a query
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))) SELECT feature_id, round(building_p95_m, 1), canopy_max_m
FROM lidar.main.height_metrics((SELECT * FROM site))
ORDER BY feature_id
Technical details
- Verified connector release
- v0.3.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'lidar' AS lidar (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-lidar-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'lidar' AS lidar (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-lidar:0.3.0'
);
Overview
Airborne LiDAR analysis over classified LAS/LAZ point clouds: building and tree-canopy heights within polygons, and vegetation encroaching on power lines within a 3D clearance distance. Uses the cloud's existing ASPRS classes; a sample point cloud is included.
GIS analysis
Read classified LAS/LAZ point clouds to estimate building and canopy heights above nearby classified ground, and find vegetation points within a three-dimensional clearance distance of supplied power-line geometry. Inputs and outputs retain caller feature IDs; horizontal coordinates and elevations must be metres. This worker uses existing ASPRS classifications: ground=2, vegetation=3/4/5, buildings=6.
SQL workflow
Pass query results to the main schema functions, retaining IDs for joins. Use bundled synthetic data to try the executable examples without network access. CRS, coverage, inference limits and resource bounds are explicit function parameters.
Sources and references
- ASPRS LAS specification (also published as an OGC community standard): the point-cloud format and the ground/vegetation/building classification codes this worker relies on.
- laspy: reads LAS files, with LASzip-compatible LAZ decompression via lazrs.
- SciPy cKDTree: the nearest-neighbour index behind ground lookup and clearance searches.
- Shapely: polygon and power-line geometry operations.
Catalog
Everything lidar exposes once attached — read straight from the worker's
released build.
main 2 functions
Spatial functions for lidar analysis.
Schema examples (4)
Estimate heights above a known flat ground surface
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))) SELECT feature_id, round(building_p95_m, 1), canopy_max_m
FROM lidar.main.height_metrics((SELECT * FROM site))
ORDER BY feature_id;
| feature_id | round(building_p95_m, 1) | canopy_max_m |
|---|---|---|
| site | 11.9 | 18 |
Run height_metrics twice over the bundled site, at the default 2 m and at a 15 m canopy threshold, and join the results: canopy cover is 0.077 and 0.038, so half of the canopy cells hold vegetation at least 15 m tall
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))), any_canopy AS (SELECT feature_id, canopy_cover_fraction AS cover_2m FROM lidar.main.height_metrics((SELECT * FROM site))), tall AS (SELECT feature_id, canopy_cover_fraction AS cover_15m FROM lidar.main.height_metrics((SELECT * FROM site), canopy_height_m := 15)) SELECT feature_id, round(cover_2m, 3) AS cover_2m, round(cover_15m, 3) AS cover_15m, round(cover_15m / cover_2m, 2) AS tall_share
FROM any_canopy
JOIN tall USING (feature_id)
ORDER BY feature_id;
Find a tree return two metres below a conductor
WITH conductor(feature_id, geometry_wkb) AS (VALUES ('line', ST_AsWKB('LINESTRING Z (500025 4100030 120, 500040 4100030 120)'::GEOMETRY))) SELECT feature_id, round(clearance_m, 2)
FROM lidar.main.vegetation_clearance((SELECT * FROM conductor))
ORDER BY feature_id, point_index;
Span vegetation report: join canopy height and cover from height_metrics over the right-of-way polygon with vegetation_clearance returns along the conductor (12 m search); Span 7 has 18 m canopy, one return within 3 m, two within 12 m, the closest at 2 m
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))), conductor(feature_id, geometry_wkb) AS (VALUES ('line', ST_AsWKB('LINESTRING Z (500025 4100030 120, 500040 4100030 120)'::GEOMETRY))), spans(span_id, corridor_id, conductor_id) AS (VALUES ('Span 7', 'site', 'line')), canopy AS (SELECT feature_id, canopy_max_m, canopy_cover_fraction FROM lidar.main.height_metrics((SELECT * FROM site))), returns AS (SELECT feature_id, count(*) FILTER (WHERE clearance_m <= 3) AS within_3m, count(*) AS within_12m, min(clearance_m) AS closest_m FROM lidar.main.vegetation_clearance((SELECT * FROM conductor), clearance_m := 12) GROUP BY feature_id) SELECT s.span_id, c.canopy_max_m, round(c.canopy_cover_fraction, 3) AS canopy_cover, coalesce(r.within_3m, 0) AS within_3m, coalesce(r.within_12m, 0) AS within_12m, round(r.closest_m, 2) AS closest_m
FROM spans s
JOIN canopy c ON c.feature_id = s.corridor_id
LEFT JOIN returns r ON r.feature_id = s.conductor_id
ORDER BY s.span_id;
height_metrics (data TABLE, canopy_height_m := DOUBLE, clearance_m := DOUBLE, cloud_crs := VARCHAR, geometry_crs := VARCHAR, grid_size_m := DOUBLE, ground_radius_m := DOUBLE, max_distance_evaluations := BIGINT, max_grid_cells := BIGINT, max_points := BIGINT, max_segments := BIGINT, path := VARCHAR, z_scale_to_m := DOUBLE)
Estimate building and canopy heights from classified LAS/LAZ points
Estimate heights above a known flat ground surface
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))) SELECT feature_id, round(building_p95_m, 1), canopy_max_m
FROM lidar.main.height_metrics((SELECT * FROM site))
ORDER BY feature_id;
| feature_id | round(building_p95_m, 1) | canopy_max_m |
|---|---|---|
| site | 11.9 | 18 |
Run height_metrics twice over the bundled site, at the default 2 m and at a 15 m canopy threshold, and join the results: canopy cover is 0.077 and 0.038, so half of the canopy cells hold vegetation at least 15 m tall
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))), any_canopy AS (SELECT feature_id, canopy_cover_fraction AS cover_2m FROM lidar.main.height_metrics((SELECT * FROM site))), tall AS (SELECT feature_id, canopy_cover_fraction AS cover_15m FROM lidar.main.height_metrics((SELECT * FROM site), canopy_height_m := 15)) SELECT feature_id, round(cover_2m, 3) AS cover_2m, round(cover_15m, 3) AS cover_15m, round(cover_15m / cover_2m, 2) AS tall_share
FROM any_canopy
JOIN tall USING (feature_id)
ORDER BY feature_id;
vegetation_clearance (data TABLE, canopy_height_m := DOUBLE, clearance_m := DOUBLE, cloud_crs := VARCHAR, geometry_crs := VARCHAR, grid_size_m := DOUBLE, ground_radius_m := DOUBLE, max_distance_evaluations := BIGINT, max_grid_cells := BIGINT, max_points := BIGINT, max_segments := BIGINT, path := VARCHAR, z_scale_to_m := DOUBLE)
Find classified vegetation within a 3D power-line clearance distance
Find a tree return two metres below a conductor
WITH conductor(feature_id, geometry_wkb) AS (VALUES ('line', ST_AsWKB('LINESTRING Z (500025 4100030 120, 500040 4100030 120)'::GEOMETRY))) SELECT feature_id, round(clearance_m, 2)
FROM lidar.main.vegetation_clearance((SELECT * FROM conductor))
ORDER BY feature_id, point_index;
Span vegetation report: join canopy height and cover from height_metrics over the right-of-way polygon with vegetation_clearance returns along the conductor (12 m search); Span 7 has 18 m canopy, one return within 3 m, two within 12 m, the closest at 2 m
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))), conductor(feature_id, geometry_wkb) AS (VALUES ('line', ST_AsWKB('LINESTRING Z (500025 4100030 120, 500040 4100030 120)'::GEOMETRY))), spans(span_id, corridor_id, conductor_id) AS (VALUES ('Span 7', 'site', 'line')), canopy AS (SELECT feature_id, canopy_max_m, canopy_cover_fraction FROM lidar.main.height_metrics((SELECT * FROM site))), returns AS (SELECT feature_id, count(*) FILTER (WHERE clearance_m <= 3) AS within_3m, count(*) AS within_12m, min(clearance_m) AS closest_m FROM lidar.main.vegetation_clearance((SELECT * FROM conductor), clearance_m := 12) GROUP BY feature_id) SELECT s.span_id, c.canopy_max_m, round(c.canopy_cover_fraction, 3) AS canopy_cover, coalesce(r.within_3m, 0) AS within_3m, coalesce(r.within_12m, 0) AS within_12m, round(r.closest_m, 2) AS closest_m
FROM spans s
JOIN canopy c ON c.feature_id = s.corridor_id
LEFT JOIN returns r ON r.feature_id = s.conductor_id
ORDER BY s.span_id;
Try these queries
Run height_metrics twice over the bundled site, at the default 2 m and at a 15 m canopy threshold, and join the results: canopy cover is 0.077 and 0.038, so half of the canopy cells hold vegetation at least 15 m tall
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))), any_canopy AS (SELECT feature_id, canopy_cover_fraction AS cover_2m FROM lidar.main.height_metrics((SELECT * FROM site))), tall AS (SELECT feature_id, canopy_cover_fraction AS cover_15m FROM lidar.main.height_metrics((SELECT * FROM site), canopy_height_m := 15)) SELECT feature_id, round(cover_2m, 3) AS cover_2m, round(cover_15m, 3) AS cover_15m, round(cover_15m / cover_2m, 2) AS tall_share
FROM any_canopy
JOIN tall USING (feature_id)
ORDER BY feature_id
Uses height_metrics
Find a tree return two metres below a conductor
WITH conductor(feature_id, geometry_wkb) AS (VALUES ('line', ST_AsWKB('LINESTRING Z (500025 4100030 120, 500040 4100030 120)'::GEOMETRY))) SELECT feature_id, round(clearance_m, 2)
FROM lidar.main.vegetation_clearance((SELECT * FROM conductor))
ORDER BY feature_id, point_index
Uses vegetation_clearance
Span vegetation report: join canopy height and cover from height_metrics over the right-of-way polygon with vegetation_clearance returns along the conductor (12 m search); Span 7 has 18 m canopy, one return within 3 m, two within 12 m, the closest at 2 m
WITH site(feature_id, geometry_wkb) AS (VALUES ('site', ST_AsWKB('POLYGON ((499995 4099995, 500045 4099995, 500045 4100045, 499995 4100045, 499995 4099995))'::GEOMETRY))), conductor(feature_id, geometry_wkb) AS (VALUES ('line', ST_AsWKB('LINESTRING Z (500025 4100030 120, 500040 4100030 120)'::GEOMETRY))), spans(span_id, corridor_id, conductor_id) AS (VALUES ('Span 7', 'site', 'line')), canopy AS (SELECT feature_id, canopy_max_m, canopy_cover_fraction FROM lidar.main.height_metrics((SELECT * FROM site))), returns AS (SELECT feature_id, count(*) FILTER (WHERE clearance_m <= 3) AS within_3m, count(*) AS within_12m, min(clearance_m) AS closest_m FROM lidar.main.vegetation_clearance((SELECT * FROM conductor), clearance_m := 12) GROUP BY feature_id) SELECT s.span_id, c.canopy_max_m, round(c.canopy_cover_fraction, 3) AS canopy_cover, coalesce(r.within_3m, 0) AS within_3m, coalesce(r.within_12m, 0) AS within_12m, round(r.closest_m, 2) AS closest_m
FROM spans s
JOIN canopy c ON c.feature_id = s.corridor_id
LEFT JOIN returns r ON r.feature_id = s.conductor_id
ORDER BY s.span_id
Lidar is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
ArcGIS
Maps & places
Live ArcGIS feature queries, server summaries and raster sampling from service URLs worldwide
Vector tiles (MVT)
Maps & places
Decode PMTiles, MBTiles, XYZ and .mvt vector tiles into DuckDB rows with GEOMETRY columns
Terrain
Maps & places
DEM visibility, viewsheds, slope and aspect from SQL