Skip to content

Commit

Permalink
Add raster draw recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
jericks committed Sep 22, 2023
1 parent 365222f commit bd2c477
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/main/docs/raster.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/test/groovy/org/geocommands/doc/DocTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/test/groovy/org/geocommands/doc/RasterTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit bd2c477

Please sign in to comment.