mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-01 09:36:53 +00:00
User interface improvements for geomarkers and geolayers
This commit is contained in:
37
plugins/tiddlywiki/geospatial/demo/ui/geolayer.tid
Normal file
37
plugins/tiddlywiki/geospatial/demo/ui/geolayer.tid
Normal file
@@ -0,0 +1,37 @@
|
||||
title: $:/plugins/tiddlywiki/geospatial/demo/ui/geolayer
|
||||
|
||||
\define create-intersection()
|
||||
<$let
|
||||
intersectLayer={{{ =[<currentTiddler>get[text]] =[<otherLayer>get[text]] +[geointersect[]] }}}
|
||||
>
|
||||
<$action-createtiddler $basetitle="$:/temp/_IsochroneLayer" text={{{ [<intersectLayer>] }}} tags="$:/tags/GeoLayer" caption={{{ [<captionThisLayer>addsuffix[ intersected with ]addsuffix<captionOtherLayer>] }}}/>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
!! Mapped
|
||||
|
||||
|
||||
<$geomap
|
||||
layers="[<currentTiddler>]"
|
||||
/>
|
||||
|
||||
!! Intersect with other layers
|
||||
|
||||
<$let
|
||||
captionThisLayer={{!!caption}}
|
||||
>
|
||||
<ul>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoLayer]sort[caption]] -[<currentTiddler>]" variable="otherLayer">
|
||||
<$let
|
||||
captionOtherLayer={{{ [<otherLayer>get[caption]else<otherLayer>] }}}
|
||||
>
|
||||
<li>
|
||||
<$link to=<<otherLayer>>><$transclude tiddler=<<otherLayer>> field="caption"><$view tiddler=<<otherLayer>> field="title"/></$transclude></$link>
|
||||
<$button actions=<<create-intersection>>>
|
||||
Create intersection
|
||||
</$button>
|
||||
</li>
|
||||
</$let>
|
||||
</$list>
|
||||
</ul>
|
||||
</$let>
|
||||
98
plugins/tiddlywiki/geospatial/demo/ui/geomarker.tid
Normal file
98
plugins/tiddlywiki/geospatial/demo/ui/geomarker.tid
Normal file
@@ -0,0 +1,98 @@
|
||||
title: $:/plugins/tiddlywiki/geospatial/demo/ui/geomarker
|
||||
|
||||
\define completion-actions()
|
||||
<$action-log/>
|
||||
<$action-setfield $tiddler="$:/temp/_StatusCode" text=<<status>>/>
|
||||
<$action-setfield $tiddler="$:/temp/_StatusText" text=<<statusText>>/>
|
||||
<$action-setfield $tiddler="$:/temp/_Error" text=<<error>>/>
|
||||
<$action-setfield $tiddler="$:/temp/_Result" text=<<data>>/>
|
||||
<$action-setfield $tiddler="$:/temp/_Headers" text=<<headers>>/>
|
||||
<$list filter="[<status>compare:number:gteq[200]compare:number:lteq[299]]" variable="ignore">
|
||||
<$action-setfield $tiddler="$:/temp/_IsochroneLayer" text={{{ [<data>] }}} tags="$:/tags/GeoLayer"/>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
\define progress-actions()
|
||||
<$action-log message="In progress-actions"/>
|
||||
<$action-log/>
|
||||
\end
|
||||
|
||||
\define payload-source()
|
||||
\rules only transcludeinline transcludeblock filteredtranscludeinline filteredtranscludeblock
|
||||
{
|
||||
"departure_searches": [
|
||||
{
|
||||
"id": "My first isochrone",
|
||||
"coords": {
|
||||
"lat": {{!!lat}},
|
||||
"lng": {{!!long}}
|
||||
},
|
||||
"departure_time": "2021-09-27T08:00:00Z",
|
||||
"travel_time": 5400,
|
||||
"transportation": {
|
||||
"type": "driving"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
\end
|
||||
|
||||
\define get-traveltime-actions()
|
||||
<$wikify name="payload" text=<<payload-source>>>
|
||||
<$action-log $message="Making payload"/>
|
||||
<$action-log/>
|
||||
<$action-sendmessage
|
||||
$message="tm-http-request"
|
||||
url="https://api.traveltimeapp.com/v4/time-map"
|
||||
method="POST"
|
||||
header-accept="application/geo+json"
|
||||
header-Content-Type="application/json"
|
||||
password-header-X-Api-Key="traveltime-secret-key"
|
||||
password-header-X-Application-Id="traveltime-application-id"
|
||||
body=<<payload>>
|
||||
var-currentTiddler=<<currentTiddler>>
|
||||
bind-status="$:/temp/plugins/tiddlywiki/geospatial/demo/traveltime/status"
|
||||
bind-progress="$:/temp/plugins/tiddlywiki/geospatial/demo/traveltime/progress"
|
||||
oncompletion=<<completion-actions>>
|
||||
onprogress=<<progress-actions>>
|
||||
/>
|
||||
</$wikify>
|
||||
\end
|
||||
|
||||
!! Mapped
|
||||
|
||||
<$geomap
|
||||
markers="[<currentTiddler>]"
|
||||
/>
|
||||
|
||||
!! Distance to other markers
|
||||
|
||||
<$let
|
||||
thisLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||
>
|
||||
<ul>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoMarker]sort[caption]] -[<currentTiddler>]">
|
||||
<li>
|
||||
<$link><$transclude field="caption"><$view field="title"/></$transclude></$link>
|
||||
--
|
||||
<$let
|
||||
otherLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||
>
|
||||
<$text text={{{ [geodistance<thisLocation>,<otherLocation>,[miles]fixed[0]] }}}/> miles
|
||||
</$let>
|
||||
</li>
|
||||
</$list>
|
||||
</ul>
|
||||
</$let>
|
||||
|
||||
!! Travel Time
|
||||
|
||||
<$button actions=<<get-traveltime-actions>>>
|
||||
Call ~TravelTime
|
||||
</$button>
|
||||
|
||||
|Status |<$text text={{$:/temp/plugins/tiddlywiki/geospatial/demo/traveltime/status}}/> |
|
||||
|Progress |<$text text={{$:/temp/plugins/tiddlywiki/geospatial/demo/traveltime/progress}}/> |
|
||||
|Status Code |<$text text={{$:/temp/_StatusCode}}/> |
|
||||
|Status Text |<$text text={{$:/temp/_StatusText}}/> |
|
||||
|Error |<$text text={{$:/temp/_Error}}/> |
|
||||
Reference in New Issue
Block a user