2023-03-16 17:22:22 +00:00
|
|
|
title: ui/geomarker
|
2022-12-12 08:54:40 +00:00
|
|
|
|
2023-01-06 10:58:50 +00:00
|
|
|
\define default-traveltime-time() 5400
|
|
|
|
|
2022-12-12 08:54:40 +00:00
|
|
|
\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>>/>
|
2023-01-05 17:11:07 +00:00
|
|
|
<$list filter="[<status>compare:number:gteq[200]compare:number:lteq[299]]" variable="ignore">
|
2023-04-25 16:27:17 +00:00
|
|
|
<$action-createtiddler $basetitle="$:/temp/_IsochroneLayer" text={{{ [<data>] }}} tags="$:/tags/GeoFeature" caption={{{ [<currentTiddler>get[caption]else<currentTiddler>addprefix[Travel time from ]] }}}/>
|
2022-12-12 08:54:40 +00:00
|
|
|
</$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": {
|
2023-01-06 10:38:27 +00:00
|
|
|
"lat": {{!!lat}},
|
|
|
|
"lng": {{!!long}}
|
2022-12-12 08:54:40 +00:00
|
|
|
},
|
2023-01-06 17:09:11 +00:00
|
|
|
"departure_time": "2023-02-27T08:00:00Z",
|
2023-01-06 10:58:50 +00:00
|
|
|
"travel_time": {{{ [[$:/config/plugins/geospatial/traveltime/time]get[text]else<default-traveltime-time>] }}},
|
2022-12-12 08:54:40 +00:00
|
|
|
"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>>
|
2023-01-06 10:38:27 +00:00
|
|
|
var-currentTiddler=<<currentTiddler>>
|
2022-12-12 08:54:40 +00:00
|
|
|
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
|
|
|
|
|
2023-01-06 10:38:27 +00:00
|
|
|
!! Mapped
|
|
|
|
|
|
|
|
<$geomap
|
2023-03-10 12:45:20 +00:00
|
|
|
state=<<qualify "$:/state/demo-map">>
|
2023-05-31 14:43:38 +00:00
|
|
|
startPosition="bounds"
|
2023-05-09 09:35:33 +00:00
|
|
|
>
|
|
|
|
<$geolayer lat={{!!lat}} long={{!!long}} alt={{!!alt}} color={{!!color}}/>
|
|
|
|
</$geomap>
|
2023-01-06 10:38:27 +00:00
|
|
|
|
|
|
|
!! Distance to other markers
|
|
|
|
|
|
|
|
<$let
|
2023-03-06 14:05:41 +00:00
|
|
|
thisLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
2023-01-06 10:38:27 +00:00
|
|
|
>
|
|
|
|
<ul>
|
|
|
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoMarker]sort[caption]] -[<currentTiddler>]">
|
|
|
|
<li>
|
2023-01-13 11:35:01 +00:00
|
|
|
<$link><$view field="caption"><$view field="title"/></$view></$link>
|
2023-01-06 10:38:27 +00:00
|
|
|
--
|
|
|
|
<$let
|
2023-03-06 14:05:41 +00:00
|
|
|
otherLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
2023-01-06 10:38:27 +00:00
|
|
|
>
|
|
|
|
<$text text={{{ [geodistance<thisLocation>,<otherLocation>,[miles]fixed[0]] }}}/> miles
|
|
|
|
</$let>
|
|
|
|
</li>
|
|
|
|
</$list>
|
|
|
|
</ul>
|
|
|
|
</$let>
|
2022-12-12 08:54:40 +00:00
|
|
|
|
2023-04-25 16:27:17 +00:00
|
|
|
!! GeoFeature Lookups
|
2023-03-06 14:06:16 +00:00
|
|
|
|
|
|
|
<$let
|
|
|
|
thisLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
|
|
|
>
|
|
|
|
<ul>
|
2023-04-25 16:27:17 +00:00
|
|
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoFeature]sort[caption]]">
|
2023-03-06 14:06:16 +00:00
|
|
|
<li>
|
|
|
|
<$text text={{{ [<currentTiddler>get[caption]] :else[<currentTiddler>] }}}/> --
|
|
|
|
<$text text={{{ [<thisLocation>geolookup{!!text}] }}}/>
|
|
|
|
</li>
|
|
|
|
</$list>
|
|
|
|
</ul>
|
|
|
|
</$let>
|
|
|
|
|
2023-01-06 10:38:27 +00:00
|
|
|
!! Travel Time
|
2022-12-12 08:54:40 +00:00
|
|
|
|
|
|
|
<$button actions=<<get-traveltime-actions>>>
|
|
|
|
Call ~TravelTime
|
|
|
|
</$button>
|
|
|
|
|
2023-01-06 10:58:50 +00:00
|
|
|
Maximum time: <$edit-text tiddler="$:/config/plugins/geospatial/traveltime/time" default=<<default-traveltime-time>> tag="input"/> seconds
|
|
|
|
|
2023-01-06 10:38:27 +00:00
|
|
|
|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}}/> |
|
2023-01-13 11:35:34 +00:00
|
|
|
|
|
|
|
<$list filter="[<currentTiddler>has[photo-url]]" variable="ignore">
|
|
|
|
|
|
|
|
!! Photo
|
|
|
|
|
|
|
|
<img src={{!!photo-url}}/>
|
|
|
|
|
|
|
|
</$list>
|