Malline:Election map example

Wikipediasta
Siirry navigaatioon Siirry hakuun
<mapframe>: JSONin Jäsennysvirhe (syntax error) jäsentäminen epäonnistui

This is Kartographer example map.

SELECT 
?city
?cityLabel
(?city as ?id) 
(SAMPLE(?img) as ?img) 
(SAMPLE(?fill) as ?fill) 
(concat('[[:d:',substr(str(?city),32,100),  ' | ', ?cityLabel, ']]') as ?title)
(concat('[[File:', substr(str(?img), 52, 100), '|200px]]') as ?description)
WHERE {
  ?item wdt:P361 wd:Q640715.
  ?item wdt:P1867 ?total_voters .
  ?item wdt:P1697 ?active_voters.
  ?item wdt:P1001 ?city.
  BIND (100*?active_voters/?total_voters AS ?percent) .
  BIND(
    if(?percent>= 75, '#610604', 
    if(?percent>= 70, '#994910', 
    if(?percent>= 65, '#D0B01F', 
    if(?percent>= 60, '#CBF13F', 
    if(?percent>= 55, '#ABF97A', 
    if(?percent>= 50, '#B1FFB3', '#a6a6a6')))))
  ) as ?fill).
  OPTIONAL { ?city wdt:P94 ?img . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en,fi,sv'. }
} GROUP BY ?city ?cityLabel

Kokeile

TemplateData[muokkaa wikitekstiä]

Syntaksivirhe JSON:ssa