Skip to content

Commit

Permalink
Add raster exponent, get value, and extract footprintln recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
jericks committed Sep 23, 2023
1 parent bd2c477 commit 294e0a1
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/main/docs/raster.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,34 @@ include::output/geoc_raster_envelope_command.txt[]
[.thumb]
image::geoc_raster_envelope_command.png[]

=== Exponent

Calculate the exponent for each cell..

include::output/geoc_raster_exp_options.txt[]

[source,bash]
----
include::output/geoc_raster_exp_command.txt[]
----

[.thumb]
image::geoc_raster_exp_command.png[]

=== Extract Footprint

Extract the footprint of the Raster as a Vector Layer.

include::output/geoc_raster_extractfootprint_options.txt[]

[source,bash]
----
include::output/geoc_raster_extractfootprint_command.txt[]
----

[.thumb]
image::geoc_raster_extractfootprint_command.png[]

=== Info

Get information about a Raster.
Expand Down Expand Up @@ -370,6 +398,22 @@ include::output/geoc_raster_getsize_command.txt[]
include::output/geoc_raster_getsize_command_output.txt[]
----

=== Get Value

Get a value from a Raster

include::output/geoc_raster_get_value_options.txt[]

[source,bash]
----
include::output/geoc_raster_get_value_command.txt[]
----

----
include::output/geoc_raster_get_value_command_output.txt[]
----


=== Reclassify

Reclassify a Raster.
Expand Down
39 changes: 39 additions & 0 deletions src/test/groovy/org/geocommands/doc/RasterTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,37 @@ class RasterTest extends DocTest {
drawOnBasemap("geoc_raster_envelope_command", [raster, layer])
}

@Test
void extractFootprint() {
String command = "geoc raster extractfootprint -i src/test/resources/earth.tif -o target/earth_footprint.shp"
String result = runApp(command, "")
writeTextFile("geoc_raster_extractfootprint_command", command)
writeTextFile("geoc_raster_extractfootprint_command_output", result)

Raster raster = new GeoTIFF(new File("src/test/resources/earth.tif")).read()
Layer layer = new Shapefile("target/earth_footprint.shp")
layer.style = new Stroke("red", 2)
drawOnBasemap("geoc_raster_extractfootprint_command", [raster, layer])
}

@Test
void exponent() {
String command = "geoc raster exp -i src/test/resources/pc.tif -o target/pc_exp.tif"
String result = runApp(command, "")
writeTextFile("geoc_raster_exp_command", command)
writeTextFile("geoc_raster_exp_command_output", result)

Raster raster = new GeoTIFF(new File("target/pc_exp.tif")).read()
raster.style = new ColorMap([
[color: "#9fd182", quantity:Math.exp(0)],
[color: "#3e7f3c", quantity:Math.exp(50)],
[color: "#133912", quantity:Math.exp(100)],
[color: "#08306b", quantity:Math.exp(200)],
[color: "#fffff5", quantity:Math.exp(500)],
])
draw("geoc_raster_exp_command", [raster])
}

@Test
void info() {
String command = "geoc raster info -i src/test/resources/earth.tif"
Expand All @@ -334,6 +365,14 @@ class RasterTest extends DocTest {
}

@Test
void getValue() {
String command = "geoc raster get value -i src/test/resources/pc.tif -x -121.799927 -y 46.867703"
String result = runApp(command)
writeTextFile("geoc_raster_get_value_command", command)
writeTextFile("geoc_raster_get_value_command_output", result)
}

@Test
void getSize() {
String command = "geoc raster size -i src/test/resources/earth.tif"
String result = runApp(command, "")
Expand Down

0 comments on commit 294e0a1

Please sign in to comment.