Skip to content

Commit

Permalink
Start adding shape recipes: arc, arcpolygon, and sinestar
Browse files Browse the repository at this point in the history
  • Loading branch information
jericks committed Aug 24, 2023
1 parent 77b87e6 commit 5a686d2
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/main/docs/vector.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,50 @@ include::output/geoc_vector_rectangle_command.txt[]
[.thumb]
image::geoc_vector_rectangle_command.png[]

=== Shapes

==== Arc

Create a arc shape around each feature of the input Layer.

include::output/geoc_vector_arc_options.txt[]

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

[.thumb]
image::geoc_vector_arc_command.png[]

==== Arc Polygon

Create a arc polygon shape around each feature of the input Layer.

include::output/geoc_vector_arcpolygon_options.txt[]

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

[.thumb]
image::geoc_vector_arcpolygon_command.png[]

==== Sine Star

Create a sinestar shape around each feature of the input Layer.

include::output/geoc_vector_sinestar_options.txt[]

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

[.thumb]
image::geoc_vector_sinestar_command.png[]

=== To

Write a Layer to a String format (CSV, GeoJSON, KML, GML, GEORSS, GPX).
Expand Down
36 changes: 36 additions & 0 deletions src/test/groovy/org/geocommands/doc/VectorTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,42 @@ import org.junit.jupiter.api.Test

class VectorTest extends DocTest {

@Test
void arc() {
String command = "geoc vector arc -i src/test/resources/data.gpkg -l countries -o target/country_arcs.shp -s 45 -e 90"
String result = runApp(command, "")
writeTextFile("geoc_vector_arc_command", command)
writeTextFile("geoc_vector_arc_command_output", result)

Layer layer = new Shapefile("target/country_arcs.shp")
layer.style = new SimpleStyleReader().read("stroke=#555555 stroke-width=0.5")
drawOnBasemap("geoc_vector_arc_command", [layer])
}

@Test
void arcPolygon() {
String command = "geoc vector arcpolygon -i src/test/resources/data.gpkg -l countries -o target/country_arcs.shp -s 45 -e 90"
String result = runApp(command, "")
writeTextFile("geoc_vector_arcpolygon_command", command)
writeTextFile("geoc_vector_arcpolygon_command_output", result)

Layer layer = new Shapefile("target/country_arcs.shp")
layer.style = new SimpleStyleReader().read("fill=silver fill-opacity=0.5 stroke=#555555 stroke-width=0.5")
drawOnBasemap("geoc_vector_arcpolygon_command", [layer])
}

@Test
void sineStar() {
String command = "geoc vector sinestar -i src/test/resources/data.gpkg -l countries -o target/country_stars.shp -n 10 -e 2"
String result = runApp(command, "")
writeTextFile("geoc_vector_sinestar_command", command)
writeTextFile("geoc_vector_sinestar_command_output", result)

Layer layer = new Shapefile("target/country_stars.shp")
layer.style = new SimpleStyleReader().read("fill=silver fill-opacity=0.5 stroke=#555555 stroke-width=0.5")
drawOnBasemap("geoc_vector_sinestar_command", [layer])
}

@Test
void add() {
runApp(["vector", "create", "-o", "target/locations.shp", "-f", "the_geom=POINT EPSG:4326", "-f", "id=integer", "-f", "name=string"], "")
Expand Down

0 comments on commit 5a686d2

Please sign in to comment.