Template:Map with marks/doc: Difference between revisions

Content deleted Content added
rm parent cats
 
(7 intermediate revisions by 2 users not shown)
Line 1:
{{documentation subpage}}
{{Uses TemplateStyles|Template:Map with marks/styles.css}}
 
Shows an image of a map, and draws user-specified images/icons on top of it using latitude/longitude coordinates.
{{see also|Template:Location map}}
To use this mapping template with standard wikipedia syntax, see {{tl|OSM Location map}}
{| class="wikitable"
|-
Line 8 ⟶ 7:
! Result
|-
| '''Simple map with a single marker, custom size, and no minimap'''<br />
{{sxhl |<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki> | width=400 | height=150 | lat=37.8 | lon=-122.4 | zoom=5 | minimap=false |
 
{{codett|2=json|{ "lat": 37.8, "lon": -122.4 } }}
}}
 
}}</nowiki> | lang=wikitext}}
| {{ {{BASEPAGENAME}} | width=400 | height=150 | lat=37.8 | lon=-122.4 | zoom=5 | minimap=false |
{ "lat": 37.8, "lon": -122.4 }
}}
|-
| '''Two markers with labels - one as diamond shape, one uses an image from Commons'''<br />''Text label can be customized with all of [https://github.com/vega/vega/wiki/Marks#text Vega text mark] parameters by prepending "text" to their name''<br />
{{sxhl |<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki> | lat=40.816667 | lon=14.433333 | zoom=6 |
 
{{codett|2=json|{"lat": 40.816667, "lon": 14.433333, "img": "wikirawupload:{{filepath:Volcano red 32x32.svg|32}}", "width": 16, "height": 16, "offsetY": -10, "text": "Mount Vesuvius", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"},}}
{{codett|2=json|{"lat": 40.948333816667, "lon": 1514.635556433333, "imgshape": "wikirawupload:{{filepath:Volcano red 32x32.svg|32}}diamond", "widthsize": 1670, "height": 16, "offsetY": -2010, "text": "Mount VultureVesuvius", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"} }},
 
}}
{{codett|2=json|{"lat": 40.816667948333, "lon": 1415.433333635556, "img": "wikirawupload:{{filepath:Volcano red 32x32.svg|32}}", "width": 16, "height": 16, "offsetY": -1020, "text": "Mount VesuviusVulture", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"},}}
 
}}</nowiki> | lang=wikitext}}
| {{ {{BASEPAGENAME}} | lat=40.948333 | lon=15.635556 | zoom=6 |
{"lat": 40.816667, "lon": 14.433333, "imgshape": "wikirawupload:{{filepath:Volcano red 32x32.svg|32}}diamond", "width": 16, "heightsize": 1670, "offsetY": -10, "text": "Mount Vesuvius", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"},
 
{"lat": 40.948333, "lon": 15.635556, "img": "wikirawupload:{{filepath:Volcano red 32x32.svg|32}}", "width": 16, "height": 16, "offsetY": -20, "text": "Mount Vulture", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"}
}}
|-
| '''One marker with labels on a blank map'''<br>
| '''Show all Armenian heritage sites''', by querying it from Wikidata<br />''The query result should have the same columns (fields) as in the other examples (<code>text, img, ...</code>), except coordinates should be returned as <code>coord</code> column''
{{sxhl |<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki> | style=osm | lat=40.347816667 | lon=4714.260433333 | zoom=6 | colorScaleField=type | wdqs=
 
''# Each ___location should show only once. This query may output all the same values as in the other examples, such as "text", "img", and others.''
{"lat": 40.816667, "lon": 14.433333, "shape": "diamond", "size": 70, "offsetY": -10, "text": "Mount Vesuvius", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"},
{{codett|2=sparql|SELECT (?item as ?id) (SAMPLE(?coord) as ?coord) (SAMPLE(?type) as ?type)}}
 
{{codett|2=sparql|WHERE {}}
}}</nowiki> | lang=wikitext}}
{{codett|2=sparql|?item wdt:P3170 ?heritageId .}}
| {{ {{BASEPAGENAME}} | style=osm | lat=40.948333 | lon=15.635556 | zoom=6 |
{{codett|2=sparql|?item wdt:P625 ?coord .}}
{"lat": 40.816667, "lon": 14.433333, "shape": "diamond", "size": 70, "offsetY": -10, "text": "Mount Vesuvius", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"},
{{codett|2=sparql|?item wdt:P31 ?type .}}
}}
|-
{{codett|2=sparql|GROUP BY ?item}}
| '''Data from Commons Dataset'''<br>''Same as above, but this time the data is stored on Commons in a table [[commons:Data:Sandbox/Yurik/Street map with marks sample.tab|Data:Sandbox/Yurik/Street map with marks sample.tab]]''<br>
}}
{{sxhl |<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki> | lat=40.948333 | lon=15.635556 | zoom=6 | table=Sandbox/Yurik/Street map with marks sample.tab}}</nowiki> | lang=wikitext}}
| {{ {{BASEPAGENAME}} | lat=40.948333 | lon=15.635556 | zoom=6 | table=Sandbox/Yurik/Street map with marks sample.tab}}
|-
| '''Show all Armenian heritage sites''', by querying it from Wikidata<br />''The query result should have the same columns (fields) as in the other examples (<code>text, img, ...</code>), except coordinates should be returned as <code>coord</code> column''
{{sxhl |<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki> | lat=40.347 | lon=47.260 | zoom=6 | colorScaleField=type | wdqs=
''# Each ___location should show only once. This query may output all the same values as in the other examples, such as "text", "img", and others.''
{{codett|2=sparql|SELECT (?item as ?id) (SAMPLE(?coord) as ?coord) (SAMPLE(?type) as ?type)}}
WHERE {
{{codett|2=sparql|?item wdt:P3170 ?heritageId .}}
{{codett|2=sparql|?item wdt:P625 ?coord .}}
{{codett|2=sparql|?item wdt:P31 ?type .}}
}
GROUP BY ?item
}}</nowiki> | lang=sparql}}
| {{ {{BASEPAGENAME}} | lat=40.347 | lon=47.260 | zoom=6 | colorScaleField=type | wdqs=
# I couldn't get type to show as text
SELECT (?item as ?id) (SAMPLE(?coord) as ?coord) (SAMPLE(?type) as ?type)
WHERE {
?item wdt:P3170 ?heritageId .
Line 48 ⟶ 67:
}}
|-
| {{#tag:syntaxhighlightsxhl |<nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki> | lat=-33.8688 | lon=151.2093 | zoom=10 |
{
"lat": -33.8688,
"lon": 151.2093,
"img": "wikirawupload:{{filepath:Opera_House_and_ferry._Sydney.jpg|48}}",
"width": 48,
"height": 36,
Line 62 ⟶ 81:
"textDx": -30
}
}}</nowiki> | lang=textwikitext}}
| {{ {{BASEPAGENAME}} | lat=-33.8688 | lon=151.2093 | zoom=10 |
{
"lat": -33.8688,
"lon": 151.2093,
"img": "wikirawupload:{{filepath:Opera_House_and_ferry._Sydney.jpg|48}}",
"width": 48,
"height": 36,
Line 133 ⟶ 152:
|}
 
==See also==
{{see* also|[[Template:Location map}}]]
To* [[Template:OSM Location map]] - to use this mapping template with standard wikipedia syntax, see {{tl|OSM Location map}}
* [[Template:Query map]] - automtically produce a map showing all of a certain type of thing in a certain area, e.g. lighthouses in Cornwall.
 
==Template data==
<templatedata>
{
Line 199 ⟶ 224:
}
</templatedata>
{{Template:Graph, chart and plot templates|cat=no}}
<includeonly> {{sandbox other||
[[Category:Graph Template Collection]]
[[Category:Graph, chart and plot templates]]
}} </includeonly>