query-33e36fc1a07185af203495efc41a97d8
Map Layer Colors. However, red as the color for countries with more than one billion people is used not only for India and China but also Equatorial Guinea and the Solomon Islands. And yesterday, I'm sure that Estonia was also red but is now green. one for population numbers, including here: coloring countries on a map Sic19I came across interesting sample queries by @Why isn't the mapping stable? Greenland yesterday also had another color (blue instead of orange). Stability would be helpful when documenting the maps somewhere else. How can I specify my own colors? Are colors being reused if the number of layers is too large? Or are these different shades of red, and I'm just not recognizing the difference? 14:10, 30 September 2018 (UTC) 37.201.181.41. Are there additional references or examples in this page's archives? Thanks in advance. --this documentation pageI could not find out more from You can specify the colour you want to assign to a range using BIND. For example, BIND(IF(?population > 1000000000, "FF0000","") AS ?rgb) will display the countries with a population of over 1 billion as red. You will need to do the same thing for each population range and assign an rgb colour to each. If you don't specify the colours they change each time the query runs. Please see the example query below:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Locations depicted in Welsh Landscape Collection, on map
#defaultView:Map{"hide":["?geo", "?rgb", "?layer"],"markercluster": true}
SELECT DISTINCT ?geo ?subj ?depicts
(SAMPLE(?sLabel) AS ?subjLabel)
(SAMPLE(?dLabel) AS ?depictsLabel)
(SAMPLE(?pic) AS ?pic)
(SAMPLE(?layer) AS ?layer)
(SAMPLE(?rgb) AS ?rgb)
WHERE {
?subj wdt:P361 wd:Q21542493 ;
wdt:P180 ?depicts .
OPTIONAL{ ?subj wdt:P18 ?pic . }
?depicts wdt:P3896 ?geo ;
wdt:P31 ?is .
VALUES ?is { wd:Q23413 wd:Q160742 wd:Q2977 wd:Q39715 wd:Q16970 wd:Q19844914 wd:Q1802963 wd:Q16884952 }
BIND(
IF(?is = wd:Q23413, "castle",
IF(?is = wd:Q160742, "abbey",
IF(?is = wd:Q2977, "cathedral",
IF(?is = wd:Q39715, "lighthouse",
IF(?is = wd:Q16970, "church",
IF(?is = wd:Q19844914, "college",
IF(?is = wd:Q1802963, "country house",
IF(?is = wd:Q16884952, "country house",
"")))))))) AS ?layer).
BIND(
IF(?is = wd:Q23413, "FF0000",
IF(?is = wd:Q160742, "0080FF",
IF(?is = wd:Q2977, "00FF00",
IF(?is = wd:Q39715, "FF00FF",
IF(?is = wd:Q16970, "FFFF00",
IF(?is = wd:Q19844914, "808080",
IF(?is = wd:Q1802963, "80ffff",
IF(?is = wd:Q16884952, "80ffff",
"")))))))) AS ?rgb).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
?subj rdfs:label ?sLabel .
?depicts rdfs:label ?dLabel . }
}
GROUP BY ?geo ?subj ?depicts