Difference between revisions of "Template:Spot"
(Hide non-working links and fetching data from hitchwiki.org/maps) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <noinclude> | + | <includeonly>==== {{{title}}} ==== |
+ | <!-- hitchwiki.org/maps doesn't work anymore; maybe it could be replaced by hitchmaps API if it exists? --> | ||
+ | <!-- mapID replaced by mapID_ to never fetch data --> | ||
+ | {{#if: {{{mapID_|}}} | {{#clear_external_data:}} | ||
+ | {{#get_web_data: url=https://hitchwiki.org/maps/api/?place={{{mapID}}}&who=HW_spot_template | ||
+ | |format=JSON | ||
+ | |data=lat=lat,lon=lon,link=link,rating=rating,exact_rating=exact_rating,ratingCount=rating_count,time=avg_textual,waitingCount=count | ||
+ | }} | ||
+ | '''[{{#external_value:link}}&zoom=16 Spot at the map]''' | ||
+ | • '''Hitchability:''' {{hitchability | {{#iferror: {{#expr: {{#external_value:exact_rating}} >= 1}} | {{#expr: 6 - {{#external_value:rating}} }} | {{#expr: ( 6 - {{#external_value:exact_rating}} ) round 1}}}}| {{#if: {{#for_external_table:{{{ratingCount}}} }} | {{#expr: ({{#for_external_table:+{{{ratingCount}}}}}) / 2}} | 1 }} }} | ||
+ | • '''Average waiting time:''' {{#ifeq: {{#external_value:time}} | Unknown | ''unknown'' | {{#external_value:time}} <sup>''based on {{#external_value:waitingCount}} experience{{#ifeq: 1 | {{#external_value:waitingCount}} ||s}}''</sup>}} | ||
+ | <!--• '''Gps coordinates:''' {{#external_value:lat}} {{#external_value:lon}}--><br /> | ||
+ | {{{description}}}<br /> | ||
+ | <!--"Comments:"-->{{#clear_external_data:}} | {{{description}}}}}</includeonly><noinclude> | ||
+ | == Under development == | ||
+ | This template was used to fetch spot data from hitchwiki.org/maps to show not only spot description but also it's rating, average waiting time and link to map. Hitchwiki.org/maps doesn't work anymore and hitchmap.com currently doesn't provide API. | ||
+ | |||
== How to use this Template? == | == How to use this Template? == | ||
− | + | === Option 1: Popular spot === | |
− | |||
<pre> | <pre> | ||
{{Spot | {{Spot | ||
− | | | + | |title = Option 1: Popular spot |
− | | | + | |mapID = 8695 |
− | |description = | + | |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From metro "Opatov" (red line C) exit straight out of the station and take a left following the winding red ramp up to street level/the road above. Look on the bus stop... |
}} | }} | ||
</pre> | </pre> | ||
+ | {{Spot | ||
+ | |title = Option 1: Popular spot | ||
+ | |mapID = 8695 | ||
+ | |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From metro "Opatov" (red line C) exit straight out of the station and take a left following the winding red ramp up to street level/the road above. Look on the bus stop... | ||
+ | }} | ||
+ | === Option 2: Unrated spot === | ||
+ | <pre>{{Spot | ||
+ | |title = Option 2: Unrated spot | ||
+ | |mapID = 10715 | ||
+ | |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From... | ||
+ | }}</pre> | ||
{{Spot | {{Spot | ||
− | | | + | |title = Option 2: Unrated spot |
− | | | + | |mapID = 10715 |
− | |description = | + | |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From... |
}} | }} | ||
+ | === Option 3: Place not connected with map === | ||
+ | <pre>{{Spot | ||
+ | |title = Option 3: Place not connected with map | ||
+ | |mapID = | ||
+ | |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From... | ||
+ | }}</pre> | ||
{{Spot | {{Spot | ||
− | | | + | |title = Option 3: Place not connected with map |
− | | | + | |mapID = |
− | |description = | + | |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From... |
}} | }} | ||
+ | |||
+ | [[Category:Templates]] | ||
</noinclude> | </noinclude> | ||
− | |||
− | |||
− |
Latest revision as of 11:15, 30 December 2024
Contents
Under development
This template was used to fetch spot data from hitchwiki.org/maps to show not only spot description but also it's rating, average waiting time and link to map. Hitchwiki.org/maps doesn't work anymore and hitchmap.com currently doesn't provide API.
How to use this Template?
Option 1: Popular spot
{{Spot |title = Option 1: Popular spot |mapID = 8695 |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From metro "Opatov" (red line C) exit straight out of the station and take a left following the winding red ramp up to street level/the road above. Look on the bus stop... }}
Option 1: Popular spot
First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From metro "Opatov" (red line C) exit straight out of the station and take a left following the winding red ramp up to street level/the road above. Look on the bus stop...
Option 2: Unrated spot
{{Spot |title = Option 2: Unrated spot |mapID = 10715 |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From... }}
Option 2: Unrated spot
First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From...
Option 3: Place not connected with map
{{Spot |title = Option 3: Place not connected with map |mapID = |description = First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From... }}
Option 3: Place not connected with map
First motorway petrol station behind Prague, really good hitchhiking but takes extra time to get there. From...