"साँचा:Maplink/doc": अवतरणों में अंतर

raw query example
पंक्ति 234:
*Use templates - if a map includes direct GeoJSON or many components, placing the data in a template will avoid cluttering the article text
See [[mw:Help:Extension:Kartographer]] for instructions.
{{maplink|frame=yes|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('[[wikipedia:', 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 <https://en.wikipedia.org/> .
} GROUP BY ?id ?head ?headLabel ?link ?stateLabel
"}|frame-width=600|frame-height=400|frame-lat=52|frame-long=-110|zoom=3}}
<pre style=min-width:30em>
{{maplink|frame=yes|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('[[wikipedia:', 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 <https://en.wikipedia.org/> .
} GROUP BY ?id ?head ?headLabel ?link ?stateLabel
"}|frame-width=600|frame-height=400|frame-lat=52|frame-long=-110|zoom=3}}
</pre>
{{-}}
===Gotchas===
*When retrieving lines or shapes from OSM, you can't style the fill color or the opacity level of fills or strokes (unless you use the {{para|raw}} parameter)