diff --git a/doc/stages/filters.ferry.rst b/doc/stages/filters.ferry.rst index 1dc03efb06..00244bb1b8 100644 --- a/doc/stages/filters.ferry.rst +++ b/doc/stages/filters.ferry.rst @@ -7,11 +7,11 @@ The ferry filter copies data from one dimension to another, creates new dimensions or both. The filter is guided by a list of 'from' and 'to' dimensions in the format -=. Data from the 'from' dimension is copied to the 'to' dimension. +=>. Data from the 'from' dimension is copied to the 'to' dimension. The 'from' dimension must exist. The 'to' dimension can be pre-existing or will be created by the ferry filter. -Alternatively, the format = can be used to create a new dimension without +Alternatively, the format => can be used to create a new dimension without copying data from any source. The values of the 'to' dimension are default initialized. @@ -40,7 +40,7 @@ pre-reprojection values and the post-reprojection values. }, { "type":"filters.ferry", - "dimensions":"X = StatePlaneX, Y=StatePlaneY" + "dimensions":"X => StatePlaneX, Y=>StatePlaneY" }, { "type":"filters.reprojection", @@ -71,7 +71,7 @@ so that the value can be set to '2' and written as a LAS file. }, { "type": "filters.ferry", - "dimensions": "=Classification" + "dimensions": "=>Classification" }, { "type": "filters.assign", @@ -86,6 +86,10 @@ Options dimensions A list of dimensions whose values should be copied. - The format of the option is =, =,... Spaces are ignored. + The format of the option is =>, =>,... + Spaces are ignored. 'from' can be left empty, in which case the 'to' dimension is created and default-initialized. 'to' dimensions will be created if necessary. + + Note: the old syntax that used '=' instead of '=>' between dimension names + is still supported. diff --git a/filters/FerryFilter.cpp b/filters/FerryFilter.cpp index 954f8975e3..6661883c86 100644 --- a/filters/FerryFilter.cpp +++ b/filters/FerryFilter.cpp @@ -64,8 +64,12 @@ void FerryFilter::initialize() StringList s = Utils::split(dim, '='); if (s.size() != 2) throwError("Invalid dimension specified '" + dim + "'. Need " - "=. See documentation for " + "=>. See documentation for " "details."); + // Allow new '=>' syntax + if (s[1][0] == '>') + s[1].erase(s[1].begin()); + Utils::trim(s[0]); Utils::trim(s[1]); if (s[0] == s[1]) diff --git a/io/GDALWriter.cpp b/io/GDALWriter.cpp index 9c3223db04..65d9f86531 100644 --- a/io/GDALWriter.cpp +++ b/io/GDALWriter.cpp @@ -210,6 +210,10 @@ bool GDALWriter::processOne(PointRef& point) void GDALWriter::doneFile() { + if (!m_grid) { + throw pdal_error("Unable to write GDAL data, grid is uninitialized. You " + "might have provided the GDALWriter zero points."); + } std::array pixelToPos; pixelToPos[0] = m_curBounds.minx; diff --git a/scripts/ci/script.sh b/scripts/ci/script.sh index 8082231c66..0f53fb8eb7 100755 --- a/scripts/ci/script.sh +++ b/scripts/ci/script.sh @@ -2,11 +2,12 @@ # Builds and tests PDAL echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories +echo "@edgecommunity http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \ apk update apk add \ cmake \ alpine-sdk \ - eigen-dev \ + eigen-dev@edgecommunity \ hexer \ hexer-dev \ nitro \ diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile index 928bafb8b5..bcef8e97ec 100644 --- a/scripts/docker/Dockerfile +++ b/scripts/docker/Dockerfile @@ -2,12 +2,13 @@ FROM alpine:3.7 RUN \ echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories; \ + echo "@edgecommunity http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \ apk update; \ apk add --no-cache --virtual .build-deps \ alpine-sdk \ unzip \ cmake \ - eigen-dev \ + eigen-dev@edgecommunity \ hexer-dev \ nitro-dev \ gdal-dev \ diff --git a/test/unit/filters/FerryFilterTest.cpp b/test/unit/filters/FerryFilterTest.cpp index 67d77bd04d..49dc0ac2e3 100644 --- a/test/unit/filters/FerryFilterTest.cpp +++ b/test/unit/filters/FerryFilterTest.cpp @@ -65,7 +65,7 @@ TEST(FerryFilterTest, stream) r.setOptions(ro); Options fo; - fo.add("dimensions", "X=FooX,Y=BarY"); + fo.add("dimensions", "X=FooX,Y=>BarY"); FerryFilter f; f.setOptions(fo); @@ -167,7 +167,7 @@ TEST(FerryFilterTest, test_ferry_invalid) Options op4; - op4.add("dimensions", "X = Y, X = NewZ = NewQ"); + op4.add("dimensions", "X = Y, X => NewZ = NewQ"); FerryFilter f4; f4.setInput(reader); f4.setOptions(op4); diff --git a/test/unit/io/GDALWriterTest.cpp b/test/unit/io/GDALWriterTest.cpp index 86bd251812..579f85b963 100644 --- a/test/unit/io/GDALWriterTest.cpp +++ b/test/unit/io/GDALWriterTest.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -546,3 +547,31 @@ TEST(GDALWriterTest, btint) EXPECT_NEAR(arr[i], data[i], .001); } +TEST(GDALWriterTest, no_points) +{ + std::string outfile(Support::temppath("out.tif")); + FileUtils::deleteFile(outfile); + + LasReader r; + Options ro; + ro.add("filename", Support::datapath("las/no-points.las")); + r.setOptions(ro); + + RangeFilter f; + f.setInput(r); + Options fo; + fo.add("limits", "Classification[2:2]"); + f.setOptions(fo); + + GDALWriter w; + w.setInput(f); + Options wo; + wo.add("resolution", 2); + wo.add("filename", outfile); + w.setOptions(wo); + + PointTable t; + w.prepare(t); + EXPECT_THROW(w.execute(t), pdal_error); +} +