[pdal] Troubleshooting GDAL writer and "Grid width out of range."

Howard Butler howard at hobu.co
Fri Jan 27 12:44:13 PST 2023


Try the --nostream option when running `pdal pipeline` and see if it will calculate grid extents for you. Additionally, make sure your limits aren't causing zero points to come through your filters.

Finally, take a look at filters.expression instead of filters.range, which was just added for PDAL 2.5 https://pdal.io/en/stable/stages/filters.expression.html The expression filter is more powerful than filters.range and probably easier to write.

Hope this helps,

Howard

> On Jan 27, 2023, at 2:12 PM, Theo Hartsook <theo.hartsook at gmail.com> wrote:
> 
> Hi everyone,
> 
> I am having trouble figuring out where the problem is with a script I am working on.
> 
> My goal is to rasterize a point cloud at different height ranges (i.e. 0-10m height above ground, 10.1-20m height above ground, etc.). 
> 
> The point cloud stored HeightAboveGround to an extra dimension and I confirmed that the values are correct by viewing in CloudCompare.
> 
> The steps I use are the following:
> 
> {'type':'readers.las', 'filename':input_las, 'extra_dims':'HeightAboveGround=float32'}
> {'type':'filters.range', 'limits':'HeightAboveGround[0:10]'}
> {'filename':band,'gdaldriver':'GTiff','output_type':'count','resolution':'1','type':'writers.gdal'}
> 
> This leads to a strange part. Mostly these steps work and produce rasters that look how I expect at that height range. It has never failed on the lowest height range, say 0-10m. However, on following height ranges, say 10-20m, I receive the following error:
> "RuntimeError: writers.gdal: Grid width out of range."
> I am not sure where in my process is triggering this error, since it works on the prior height range. The range filter works at each height range, even when the GDAL step fails. I confirmed this by writing the filtered point clouds to disc instead of rasterizing them and viewing them in CloudCompare.
> 
> I created another version of this same point cloud where the Z values were replaced with HeightAboveGround using the ferry filter and then saved to disc. When I change the range filter to select for Z instead of height above ground, the raster step doesn't throw an error at any height range and produces the results I expect. However, if I try to add these steps to the pipeline when reading the original point cloud (read point cloud with HeightAboveGround, ferry HeightAboveGround to Z, then range filter for Z values), I still get the Grid width out of range error on the second height range.
> 
> I tested one last thing. I wondered if there was some error with how my script generated the height ranges. So I manually ran the filter at the next increment (10-20m) and unfortunately still got the same error. This scenario has me quite confused and I would appreciate any help and advice! My best guess from my tests is that the problem lies with the GDAL step, not prior.
> 
> Best regards,
> Theo Hartsook
> _______________________________________________
> pdal mailing list
> pdal at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/pdal



More information about the pdal mailing list