diff --git a/src/filters/InPlaceReprojection.cpp b/src/filters/InPlaceReprojection.cpp index 443ea06c17..19db1c1f80 100644 --- a/src/filters/InPlaceReprojection.cpp +++ b/src/filters/InPlaceReprojection.cpp @@ -557,20 +557,24 @@ void IteratorBase::updateBounds(PointBuffer& buffer) return; } - try - { - Bounds newBounds(minx, miny, minz, maxx, maxy, maxz); - - buffer.setSpatialBounds(newBounds); - - } - catch (pdal::bounds_error&) - { - Bounds newBounds(minx, miny, oldBounds.getMinimum(2), maxx, maxy, oldBounds.getMaximum(2)); - - buffer.setSpatialBounds(newBounds); - - } + try + { + Bounds newBounds(minx, miny, minz, maxx, maxy, maxz); + buffer.setSpatialBounds(newBounds); + } + catch (pdal::bounds_error&) + { + try + { + Bounds newBounds(minx, miny, oldBounds.getMinimum(2), maxx, maxy, oldBounds.getMaximum(2)); + buffer.setSpatialBounds(newBounds); + } + catch (pdal::bounds_error&) + { + Bounds newBounds = buffer.calculateBounds(true); + buffer.setSpatialBounds(newBounds); + } + } return; }