From bd2c477ccff94edc1d1e6dd7d7ef1d37f5666d72 Mon Sep 17 00:00:00 2001 From: Jared Erickson Date: Fri, 22 Sep 2023 16:45:41 -0700 Subject: [PATCH] Add raster draw recipe --- src/main/docs/raster.adoc | 14 ++++++++++++++ src/test/groovy/org/geocommands/doc/DocTest.groovy | 3 ++- .../groovy/org/geocommands/doc/RasterTest.groovy | 9 +++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/docs/raster.adoc b/src/main/docs/raster.adoc index 64c2b21b..7e3c5de0 100644 --- a/src/main/docs/raster.adoc +++ b/src/main/docs/raster.adoc @@ -297,6 +297,20 @@ Raster / 2.1 [.thumb] image::geoc_raster_divide_constant_command_divided.png[] +=== Draw + +Draw a Raster to an image. + +include::output/geoc_raster_draw_options.txt[] + +[source,bash] +---- +include::output/geoc_raster_draw_command.txt[] +---- + +[.thumb] +image::geoc_raster_draw_command.png[] + === Envelope Get the Envelope of a Raster as a Vector Layer. diff --git a/src/test/groovy/org/geocommands/doc/DocTest.groovy b/src/test/groovy/org/geocommands/doc/DocTest.groovy index b3e26b74..aaf7e02f 100644 --- a/src/test/groovy/org/geocommands/doc/DocTest.groovy +++ b/src/test/groovy/org/geocommands/doc/DocTest.groovy @@ -42,13 +42,14 @@ class DocTest extends BaseTest { Option opt = annotation as Option String name = opt.name() List aliases = opt.aliases() + boolean isRequired = opt.required() String alias = aliases.isEmpty() ? "" : aliases.first() String usage = opt.usage() if (name.startsWith("--")) { alias = name name = "" } - options.add([name: name, alias: alias, usage: usage]) + options.add([name: name, alias: alias, usage: usage, required: isRequired]) } } } diff --git a/src/test/groovy/org/geocommands/doc/RasterTest.groovy b/src/test/groovy/org/geocommands/doc/RasterTest.groovy index f4e634ab..390814d6 100644 --- a/src/test/groovy/org/geocommands/doc/RasterTest.groovy +++ b/src/test/groovy/org/geocommands/doc/RasterTest.groovy @@ -303,6 +303,15 @@ class RasterTest extends DocTest { draw("geoc_raster_divide_constant_command_divided", [dividedRaster, createLayer(dividedRaster, vectorStyle)]) } + @Test + void draw() { + String command = "geoc raster draw -i src/test/resources/earth.tif -f target/image.png" + String result = runApp(command, "") + writeTextFile("geoc_raster_draw_command", command) + writeTextFile("geoc_raster_draw_command_output", result) + copyFile(new File("target/image.png"), new File("src/main/docs/images/geoc_raster_draw_command.png")) + } + @Test void envelope() { String command = "geoc raster envelope -i src/test/resources/earth.tif -o target/earth_envelope.shp"