Template:Maplink/testcases

{{Testcases}}

Missing map data

{{Test case|_collapsible=yes|_showcode=yes|_title=No args}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Just type arg|type=line}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Missing data|type=line|id=Q12345}}

Mapframe tag

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple geoline

|frame=yes|type=line|id=Q2108}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple geoline with coordinates on Wikidata

|frame=yes|type=line|id=Q515443}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Frame latitude & longitude (simple geoline)

|frame=yes|frame-lat=42.4934|frame-long=-82.9166|zoom=8|type=line|id=Q2108}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Frame latitude & longitude within {{tl|Coord}} template (simple geoline)

|_code={{__TEMPLATENAME__|frame=yes|frame-coordinates={{Coord|41.9|N|82.7|W}}|zoom=7|type=line|id=Q2108}}

|frame=yes|frame-coordinates={{Coord|41.9|N|82.7|W}}|zoom=7|type=line|id=Q2108}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Frameless (simple geoline)

|frame=yes|plain=yes|frame-lat=42.4934|frame-long=-82.9166|zoom=8|type=line|id=Q2108}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple geoshape

|frame=yes|type=shape|id=Q797}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple geomask

|frame=yes|type=shape-inverse|id=Q797}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple Data: page

|frame=yes|type=data|from=Sandbox/Evad37/St Georges Terrace.map|}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Raw data

|_code={{__TEMPLATENAME__||frame=yes|type=data|raw={{Wikipedia:Map data/Wikipedia KML/Interstate 45}}}}

|frame=yes|type=data|raw={{Wikipedia:Map data/Wikipedia KML/Interstate 45}}}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Raw Wikidata query

|_code={{__TEMPLATENAME__||frame=yes|type=data|frame-width=600|frame-height=400|frame-lat=52|frame-long=-110|zoom=3|raw={

"type": "ExternalData",

"service": "geoshape",

"query": "

SELECT ?id ?head

(SAMPLE(?img) as ?img_)

(min(?partyId) as ?party)

(if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill)

(concat('', substr(str(?link),31,500), '{{!}}', ?headLabel, '') as ?title)

(concat(?stateLabel, '\\n', 'File:', substr(str(?img_), 52, 500), '{{!}}200px') as ?description)

WHERE {

?id wdt:P31 wd:Q35657 .

?id wdt:P6 ?head .

?head wdt:P102 ?party .

BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId)

SERVICE wikibase:label {

bd:serviceParam wikibase:language 'en' .

?head rdfs:label ?headLabel .

?id rdfs:label ?stateLabel .

}

OPTIONAL {

?head wdt:P18 ?img .

}

?link schema:about ?head .

?link schema:isPartOf .

} GROUP BY ?id ?head ?headLabel ?link ?stateLabel

"} }}

|frame=yes|type=data|frame-width=600|frame-height=400|frame-lat=52|frame-long=-110|zoom=3|raw={

"type": "ExternalData",

"service": "geoshape",

"query": "

SELECT ?id ?head

(SAMPLE(?img) as ?img_)

(min(?partyId) as ?party)

(if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill)

(concat('', substr(str(?link),31,500), '{{!}}', ?headLabel, '') as ?title)

(concat(?stateLabel, '\\n', 'File:', substr(str(?img_), 52, 500), '{{!}}200px') as ?description)

WHERE {

?id wdt:P31 wd:Q35657 .

?id wdt:P6 ?head .

?head wdt:P102 ?party .

BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId)

SERVICE wikibase:label {

bd:serviceParam wikibase:language 'en' .

?head rdfs:label ?headLabel .

?id rdfs:label ?stateLabel .

}

OPTIONAL {

?head wdt:P18 ?img .

}

?link schema:about ?head .

?link schema:isPartOf .

} GROUP BY ?id ?head ?headLabel ?link ?stateLabel

"} }}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|frame=yes|type=point|coord={{coord|-15.4|17.2}}}}|_title=Simple point (supplied coordinates, {{!}}lat{{!}}long )

|frame=yes|type=point|coord={{coord|-15.4|17.2}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|frame=yes|type=point|coord={{coord|15.4|S|17.2|E}}}}|_title=Simple point (supplied coordinates, {{!}}lat{{!}}S{{!}}long{{!}}E )

|frame=yes|type=point|coord={{coord|15.4|S|17.2|E}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|frame=yes|type=point|coord={{coord|15|24|S|17|12|E}}}}|_title=Simple point (supplied coordinates, {{!}}lat_d{{!}}lat_m{{!}}S{{!}}long_d{{!}}long_m{{!}}E )

|frame=yes|type=point|coord={{coord|15|24|S|17|12|E}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|frame=yes|type=point|coord={{coord|15|24|10|S|17|12|15|E}}}}|_title=Simple point (supplied coordinates, {{!}}lat_d{{!}}lat_m{{!}}lat_s{{!}}S{{!}}long_d{{!}}long_m{{!}}long_s{{!}}E )

|frame=yes|type=point|coord={{coord|15|24|10|S|17|12|15|E}}}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple point (Wikidata coordinates)

|frame=yes|type=point|id=Q797}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Point from Wikidata, but with novalue set on item (error expected)

|frame=yes|type=point|id=Q2327957}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|frame=yes|type=circle|radius=1000|coord={{coord|-31.95|115.85}}}}|_title=Simple circle (supplied coordinates)

|frame=yes|type=circle|radius=1000|coord={{coord|-31.95|115.85}}}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple circle (wikidata coordinates)

|frame=yes|type=circle|radius=5000|id=Q60}}

Multiple features

=Mapframe tag=

{{Test case|_collapsible=yes|_showcode=yes|_title=2 lines

|frame=yes|type=line|id=Q1318331|type2=line|id2=Q1544264}}

{{Test case|_collapsible=yes|_showcode=yes|_title=2 shapes

|frame=yes|type=shape|id=Q100|type2=shape|id2=Q1384}}

{{Test case|_collapsible=yes|_showcode=yes|_title=2 .map pages

|frame=yes|type=data|from=MAX Light Rail (Perth).map|type2=data|from2=Sandbox/Evad37/St Georges Terrace.map}}

{{Test case|_collapsible=yes|_showcode=yes|_title=2 points (manually specified)|_code={{__TEMPLATENAME__|frame=yes|type=point|coord={{coord|32|S|116|E}}|type2=point|coord2={{coord|31.8|S|115.8|E}}}}

|frame=yes|type=point|coord={{coord|32|S|116|E}}|type2=point|coord2={{coord|31.8|S|115.8|E}}}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Line + point|_code={{__TEMPLATENAME__|frame=yes|id=Q1318331|type=line|type2=point|coord2={{coord|32|S|116|E}}}}

|frame=yes|id=Q1318331|type=line|type2=point|coord2={{coord|32|S|116|E}}}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Shape + point|_code={{__TEMPLATENAME__|frame=yes|type=shape|id=Q3495894|type2=point|coord2={{coord|32|S|116|E}}}}

|frame=yes|type=shape|id=Q3495894|type2=point|coord2={{coord|32|S|116|E}}}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Shape + line

|frame=yes|type=shape|id=Q3495894|type2=line|id2=Q1318331}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Shape + line + point|_code={{__TEMPLATENAME__|frame=yes|type=shape|id=Q3495894|type2=line|id2=Q1318331|type3=point|coord3={{coord|32|S|116|E}}}}

|frame=yes|type=shape|id=Q3495894|type2=line|id2=Q1318331|type3=point|coord3={{coord|32|S|116|E}}}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Point within a shape, with various optional/style parameters

|frame=yes|plain=yes|frame-width=250|frame-height=280|type=shape-inverse|zoom=7|frame-lat=29.185|frame-long=76.225|stroke-width=3|id=Q1174|type2=point|id2=Q200663|title2=Faridabad}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Line + Shape-inverse + point|_code={{__TEMPLATENAME__|frame=yes|type=line|id=Q1318331|type2=shape-inverse|id2=Q3495894|type3=point|coord3={{coord|32|S|116|E}}}}

|frame=yes

|type=line|id=Q1318331

|type2=shape-inverse|id2=Q3495894

|type3=point|coord3={{coord|32|S|116|E}}

}}

Styles

{{Test case|_collapsible=yes|_showcode=yes|_title=Stroke width and stroke colour for line

|frame=yes|zoom=9|type=line|id=Q100|stroke-width=3|stroke-color=#008888}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Stroke width, stroke colour, and fill colour for shape

|frame=yes|zoom=9|type=shape|id=Q100|stroke-width=3|stroke-color=#008888|fill=#00ff00}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Stroke width, stroke colour, and fill colour for shape-inverse

|frame=yes|zoom=9|type=shape-inverse|id=Q100|stroke-width=3|stroke-color=#00ffff|fill=#888888}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Marker symbol and colour for point

|frame=yes|zoom=9|type=point|id=Q100|marker=star|marker-color=#888800}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Stroke-opacity and fill-opacity for shape

|frame=yes|zoom=9|type=shape|id=Q100|stroke-width=3|stroke-color=#008888|stroke-opacity=0.4|fill=#00ff00|fill-opacity=0.4}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Stroke-opacity and fill-opacity for shape-inverse

|frame=yes|zoom=9|type=shape-inverse|id=Q100|stroke-width=3|stroke-color=#008888|stroke-opacity=0.4|fill=#00ff00|fill-opacity=0.4}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Stroke width, stroke colour, and fill colour for circle

|frame=yes|zoom=9|type=circle|radius=10000|id=Q100|stroke-width=3|stroke-color=#008888|fill=#00ff00}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Stroke-opacity and fill-opacity for circle

|frame=yes|zoom=9|type=circle|radius=10000|id=Q100|stroke-width=3|stroke-color=#008888|stroke-opacity=0.4|fill=#00ff00|fill-opacity=0.4}}

Circles

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|type=circle|radius_m=1110|coord={{coord|-31.95|115.85}}}}|_title=Radius in metres

|type=circle|radius_m=1110|coord={{coord|-31.95|115.85}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|type=circle|radius_km=10|coord={{coord|-31.95|115.85}}}}|_title=Radius in kilometres

|type=circle|radius_km=10|coord={{coord|-31.95|115.85}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|type=circle|radius_mi=10|coord={{coord|-31.95|115.85}}}}|_title=Radius in miles

|type=circle|radius_mi=10|coord={{coord|-31.95|115.85}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|type=circle|radius_ft=200|coord={{coord|-31.95|115.85}}}}|_title=Radius in feet

|type=circle|radius_ft=200|coord={{coord|-31.95|115.85}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|type=circle|radius=1000|edges=8|coord={{coord|-31.95|115.85}}}}|_title=Fewer edges

|type=circle|radius=1000|edges=8|coord={{coord|-31.95|115.85}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|type=circle|radius=1000|edges=68|coord={{coord|-31.95|115.85}}}}|_title=Extra edges

|type=circle|radius=1000|edges=68|coord={{coord|-31.95|115.85}}}}

{{Test case|_collapsible=yes|_showcode=yes|_code={{__TEMPLATENAME__|type=circle|radius_m=1110|coord={{coord|-31.95|115.85}}}}|_title=No radius specified (error expected)

|type=circle|coord={{coord|-31.95|115.85}}}}

Geomasks

{{Test case|_collapsible=yes|_showcode=yes|_title=Geomask with hole

|type=shape-inverse|id=Q7998839|frame=yes}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Geomask with holes and stroke styles

|frame=yes|plain=y|frame-width=135|frame-height=200|frame-align=center|stroke-width=2|zoom=9|type=shape-inverse|stroke-color=#808080|id=Q16567|title=Columbus}}

Multi switcher

{{Test case|_collapsible=yes|_showcode=yes|_title=Multiple zoom levels (specifying numbers)

|frame=yes|plain=yes|switch=zoomed out; zoomed mid; zoomed in|type=point|id=Q100|zoom=SWITCH:5;8;11}}

{{Test case|_collapsible=yes|_showcode=yes|_title= Multiple geolines (shape outlines), which are auto-zoomed

|frame=yes |plain=yes |frame-align=left |type=point |id=Q100 |type2=line |stroke-width2=1 |id2=SWITCH:Q578170, Q771, Q100 |switch=country, state, city}}

{{cot|Inside an infobox}}

style=width:50%|{{tl|maplink}}{{tl|maplink/sandbox}}
{{Infobox

|above = Some infobox

|image = {{maplink|frame=yes|plain=yes|frame-align=center|switch=zoomed out; zoomed mid; zoomed in|type=point|id=Q100|zoom=SWITCH:3,7,1}}

|caption = A caption for the mapframe

}}

| {{Infobox

|above = Some infobox

|image = {{maplink/sandbox|frame=yes|plain=yes|frame-align=center|switch=zoomed out; zoomed mid; zoomed in|type=point|id=Q100|zoom=SWITCH:3,7,1}}

|caption = A caption for the mapframe

}}

{{cob}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Framed, align right

|frame=yes|text=Captiony thingy|switch=zoomed out; zoomed mid; zoomed in|type=point|id=Q100|zoom=SWITCH:5;8;11}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Framed, align left, no text

|frame=yes |frame-align=left |type=point |id=Q100 |type2=line |stroke-width2=1 |id2=SWITCH:Q578170, Q771, Q100 |switch=country, state, city}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Framed, align center

|frame=yes|frame-align=center|switch=zoomed out; zoomed mid; zoomed in|type=point|id=Q100|zoom=SWITCH:3,7,11}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Multiple switch parameters (zoom and geomask)

|frame=yes |frame-align=center |switch=demo #1, demo#2, demo#3 |zoom=SWITCH:2,6,10 |type1=shape-inverse |id=SWITCH:Q30, Q771, Q100 |type2=point |id2=Q100 |text=Foo bar baz}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Multiple switch parameters (zoom and frame-coord) |_code =

{{__TEMPLATENAME__|frame=yes |frame-align=center |switch=demo #1, demo#2, demo#3 |zoom=SWITCH:2,6,10 |type1=point |id1=Q100 |frame-coord=SWITCH:{{Coord|1|23|N|2|34|E}}###{{Coord|32|1|S|115|6|E}}###{{Coord|32|1|N|115|6|W}}}}

|frame=yes |frame-align=center |switch=demo #1, demo#2, demo#3 |zoom=SWITCH:2,6,10 |type1=point |id1=Q100 |frame-coord=SWITCH:{{Coord|1|23|N|2|34|E}}###{{Coord|32|1|S|115|6|E}}###{{Coord|32|1|N|115|6|W}}}}

= Errors expected =

{{cot}}

{{Test case|_collapsible=yes|_showcode=yes|_title=No SWITCH: lists

|frame=yes|plain=yes|switch=zoomed out; zoomed in|type=point|id=Q100|zoom=5}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Not enough labels

|frame=yes|plain=yes|switch=zoomed out; zoomed in|type=point|id=Q100|zoom=SWITCH:5;8;11}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Only one label

|frame=yes|plain=yes|switch=zoomed out|type=point|id=Q100|zoom=SWITCH:5;8;11}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Only one value in SWITCH: list

|frame=yes|plain=yes|switch=zoomed out, zoomed in|type=point|id=Q100|zoom=SWITCH:5}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Differing numbers values in SWITCH: list

|frame=yes|plain=yes|switch=zoomed out; zoomed in|type=point|id=SWITCH:Q30, Q100|zoom=SWITCH:5;8;11}}

{{Test case|_collapsible=yes|_showcode=yes|_title=Set alignment to 'none'

|frame=yes |frame-align=none |type=point |id=Q100 |type2=line |stroke-width2=1 |id2=SWITCH:Q578170, Q771, Q100 }}

{{cob}}

Named coordinates test data

class="wikitable collapsible collapsed" style=width:100%

|+Some data from Netherton Tunnel Branch Canal article:

! Point

! Coordinates
(links to map & photo sources)

Dudley Port Junction

| {{coord|52.52204

2.04331|region:GB_type:landmark|name=Dudley Port Junction}}
Groveland Bridge (Tipton Road, A457)

| {{coord|52.51758

2.04760|region:GB_type:landmark|name=Groveland Bridge (Tipton Road, A457)}}
Tividale Aqueduct (Old BCN Main Line)

| {{coord|52.51640

2.04843|region:GB_type:landmark|name=Tividale Aqueduct (Old BCN Main Line)}}
Northern tunnel portal

| {{coord|52.51534

2.04948|region:GB_type:landmark|name=Northern tunnel portal}}
Aston Road air vent

| {{coord|52.50850

2.05518|region:GB_type:landmark|name=Aston Road air vent}}
Regent Road air vent

| {{coord|52.50697

2.05708|region:GB_type:landmark|name=Regent Road air vent}}
Approx. tunnel midpoint

| {{coord|52.50435

2.05932|region:GB_type:landmark|name=Approx. tunnel midpoint}}

Named coordinates

class="wikitable collapsible collapsed" style=width:100%

|+Further data from Netherton Tunnel Branch Canal article:

Southern tunnel portal

| {{coord|52.49335

2.06916|region:GB_type:landmark|name=Southern tunnel portal}}
Windmill End Junction

| {{coord|52.49157

2.07019|region:GB_type:landmark|name=Windmill End Junction}}

{{Test case|_collapsible=yes|_showcode=yes|_title=All coordinates on page

|frame=yes|type=named}}

{{Test case|_collapsible=yes|_showcode=yes|_title=All coordinates on page in a section

|frame=yes|type=named|from=#Named coordinates}}

{{Test case|_collapsible=yes|_showcode=yes|_title=All coordinates on another page

|frame=yes|type=named|from=List of bridges in Perth, Western Australia}}

{{Test case|_collapsible=yes|_showcode=yes|_title=All coordinates on page plus a geoshape

|frame=yes|type=named

|type2=shape-inverse|id2=Q23124

|type3=line|id3=Q23124}}

{{Test case|_collapsible=yes|_showcode=yes|_title=With style params

|frame=yes|type=named|from=#Named coordinates|marker=star|marker-color=#ff0000}}

Overlays

{{Test case|_collapsible=yes|_showcode=yes|_title=Simple overlay|_code={{__TEMPLATENAME__|frame=yes|plain=yes|type=point|id=Q100|overlay={{mapframe|frame=yes|plain=yes|frame-width=100|frame-height=100|type=shape|id=Q100|zoom=5}} }}

|frame=yes|plain=yes|type=point|id=Q100|overlay={{mapframe|frame=yes|plain=yes|frame-width=100|frame-height=100|type=shape|id=Q100|zoom=5}}

}}