From 4b653c2547a2fb2e75a0ce969fdeea5a35ebab66 Mon Sep 17 00:00:00 2001
From: "jeremy@jermolene.com"
Date: Wed, 31 May 2023 09:38:19 +0100
Subject: [PATCH] Add interactive demos for geounion, geodifference,
geointersection
---
.../geospatial/docs/geodifference.tid | 7 +++
.../geospatial/docs/geointersect.tid | 7 +++
.../tiddlywiki/geospatial/docs/geounion.tid | 7 +++
.../operators/geodifference-interactive.tid | 62 +++++++++++++++++++
.../operators/geointersect-interactive.tid | 62 +++++++++++++++++++
.../tests/operators/geounion-interactive.tid | 62 +++++++++++++++++++
6 files changed, 207 insertions(+)
create mode 100644 plugins/tiddlywiki/geospatial/tests/operators/geodifference-interactive.tid
create mode 100644 plugins/tiddlywiki/geospatial/tests/operators/geointersect-interactive.tid
create mode 100644 plugins/tiddlywiki/geospatial/tests/operators/geounion-interactive.tid
diff --git a/plugins/tiddlywiki/geospatial/docs/geodifference.tid b/plugins/tiddlywiki/geospatial/docs/geodifference.tid
index 96c354eb2..b9ce47381 100644
--- a/plugins/tiddlywiki/geospatial/docs/geodifference.tid
+++ b/plugins/tiddlywiki/geospatial/docs/geodifference.tid
@@ -11,3 +11,10 @@ Each input list item is interpreted as a [[GeoJSON Polygon Feature Collection]]
```
[geodifference[]]
```
+
+!! Examples
+
+<$testcase>
+<$data $compound-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/geodifference-interactive"/>
+<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
+$testcase>
diff --git a/plugins/tiddlywiki/geospatial/docs/geointersect.tid b/plugins/tiddlywiki/geospatial/docs/geointersect.tid
index 67ea1071f..ac43ebecb 100644
--- a/plugins/tiddlywiki/geospatial/docs/geointersect.tid
+++ b/plugins/tiddlywiki/geospatial/docs/geointersect.tid
@@ -11,3 +11,10 @@ Each input list item is interpreted as a [[GeoJSON Polygon Feature Collection]]
```
[geointersect[]]
```
+
+!! Examples
+
+<$testcase>
+<$data $compound-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/geointersect-interactive"/>
+<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
+$testcase>
diff --git a/plugins/tiddlywiki/geospatial/docs/geounion.tid b/plugins/tiddlywiki/geospatial/docs/geounion.tid
index e5fc3a53d..f23d3dfa2 100644
--- a/plugins/tiddlywiki/geospatial/docs/geounion.tid
+++ b/plugins/tiddlywiki/geospatial/docs/geounion.tid
@@ -11,3 +11,10 @@ Each input list item is interpreted as a [[GeoJSON Polygon Feature Collection]]
```
[geounion[]]
```
+
+!! Examples
+
+<$testcase>
+<$data $compound-tiddler="$:/plugins/tiddlywiki/geospatial/tests/operators/geounion-interactive"/>
+<$data $tiddler="$:/plugins/tiddlywiki/geospatial"/>
+$testcase>
diff --git a/plugins/tiddlywiki/geospatial/tests/operators/geodifference-interactive.tid b/plugins/tiddlywiki/geospatial/tests/operators/geodifference-interactive.tid
new file mode 100644
index 000000000..547bf0bb5
--- /dev/null
+++ b/plugins/tiddlywiki/geospatial/tests/operators/geodifference-interactive.tid
@@ -0,0 +1,62 @@
+title: $:/plugins/tiddlywiki/geospatial/tests/operators/geodifference-interactive
+description: geodifference operator interactive example
+type: text/vnd.tiddlywiki-multiple
+tags: [[$:/tags/wiki-test-spec]]
+
+title: Description
+
+geodifference operator interactive example
++
+title: Output
+
+\whitespace trim
+<$geomap
+ state=<>
+ startPosition="bounds"
+ layersPanel="open"
+>
+<$geolayer json={{LayerOne}} name="LayerOne" color="red"/>
+<$geolayer json={{LayerTwo}} name="LayerTwo" color="yellow"/>
+<$geolayer json={{{ =[{LayerOne}] =[{LayerTwo}] +[geodifference[]] }}} name="Difference of LayerOne and LayerTwo" color="blue"/>
+$geomap>
++
+title: LayerOne
+type: application/json
+
+{
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [
+ [[100.0,0.0],[102.0,0.0],[102.0,2.0],[100.0,2.0],[100.0,0.0]]
+ ]
+ }
+ }
+ ]
+}
++
++
+title: LayerTwo
+type: application/json
+
+{
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [
+ [[101.0,1.0],[103.0,1.0],[103.0,3.0],[101.0,3.0],[101.0,1.0]]
+ ]
+ }
+ }
+ ]
+}
++
+title: ExpectedResult
+
+
\ No newline at end of file
diff --git a/plugins/tiddlywiki/geospatial/tests/operators/geointersect-interactive.tid b/plugins/tiddlywiki/geospatial/tests/operators/geointersect-interactive.tid
new file mode 100644
index 000000000..1232ceb43
--- /dev/null
+++ b/plugins/tiddlywiki/geospatial/tests/operators/geointersect-interactive.tid
@@ -0,0 +1,62 @@
+title: $:/plugins/tiddlywiki/geospatial/tests/operators/geointersect-interactive
+description: geointersect operator interactive example
+type: text/vnd.tiddlywiki-multiple
+tags: [[$:/tags/wiki-test-spec]]
+
+title: Description
+
+geointersect operator interactive example
++
+title: Output
+
+\whitespace trim
+<$geomap
+ state=<>
+ startPosition="bounds"
+ layersPanel="open"
+>
+<$geolayer json={{LayerOne}} name="LayerOne" color="red"/>
+<$geolayer json={{LayerTwo}} name="LayerTwo" color="yellow"/>
+<$geolayer json={{{ =[{LayerOne}] =[{LayerTwo}] +[geointersect[]] }}} name="Intersection of LayerOne and LayerTwo" color="blue"/>
+$geomap>
++
+title: LayerOne
+type: application/json
+
+{
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [
+ [[100.0,0.0],[102.0,0.0],[102.0,2.0],[100.0,2.0],[100.0,0.0]]
+ ]
+ }
+ }
+ ]
+}
++
++
+title: LayerTwo
+type: application/json
+
+{
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [
+ [[101.0,1.0],[103.0,1.0],[103.0,3.0],[101.0,3.0],[101.0,1.0]]
+ ]
+ }
+ }
+ ]
+}
++
+title: ExpectedResult
+
+
\ No newline at end of file
diff --git a/plugins/tiddlywiki/geospatial/tests/operators/geounion-interactive.tid b/plugins/tiddlywiki/geospatial/tests/operators/geounion-interactive.tid
new file mode 100644
index 000000000..bdae10a7e
--- /dev/null
+++ b/plugins/tiddlywiki/geospatial/tests/operators/geounion-interactive.tid
@@ -0,0 +1,62 @@
+title: $:/plugins/tiddlywiki/geospatial/tests/operators/geounion-interactive
+description: geounion operator interactive example
+type: text/vnd.tiddlywiki-multiple
+tags: [[$:/tags/wiki-test-spec]]
+
+title: Description
+
+geounion operator interactive example
++
+title: Output
+
+\whitespace trim
+<$geomap
+ state=<>
+ startPosition="bounds"
+ layersPanel="open"
+>
+<$geolayer json={{LayerOne}} name="LayerOne" color="red"/>
+<$geolayer json={{LayerTwo}} name="LayerTwo" color="yellow"/>
+<$geolayer json={{{ =[{LayerOne}] =[{LayerTwo}] +[geounion[]] }}} name="Union of LayerOne and LayerTwo" color="blue"/>
+$geomap>
++
+title: LayerOne
+type: application/json
+
+{
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [
+ [[100.0,0.0],[102.0,0.0],[102.0,2.0],[100.0,2.0],[100.0,0.0]]
+ ]
+ }
+ }
+ ]
+}
++
++
+title: LayerTwo
+type: application/json
+
+{
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "geometry": {
+ "type": "Polygon",
+ "coordinates": [
+ [[101.0,1.0],[103.0,1.0],[103.0,3.0],[101.0,3.0],[101.0,1.0]]
+ ]
+ }
+ }
+ ]
+}
++
+title: ExpectedResult
+
+
\ No newline at end of file