Created
November 2, 2021 08:08
-
-
Save wiso/b30c3197503a4cb9ad3d5402ebb27883 to your computer and use it in GitHub Desktop.
power_plant_wikidata.sparql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT ?item ?itemLabel ?countryLabel ?capacity_in_Mw ?stateLabel ?coords ?layer | |
WHERE | |
{ | |
?item (wdt:P31/(wdt:P279*)) wd:Q159719; | |
p:P2109 ?stmnode; | |
wdt:P625 ?coords . | |
?stmnode psn:P2109 ?valuenode. # normalised value | |
?valuenode wikibase:quantityAmount ?capacity_in_W. | |
BIND(?capacity_in_W / "1e6"^^xsd:double AS ?capacity_in_Mw) | |
OPTIONAL{?item wdt:P17 ?country .} | |
OPTIONAL{?item wdt:P5817 ?state .} | |
BIND( | |
IF(?capacity_in_Mw < 1000, "<1GW", | |
IF(?capacity_in_Mw < 2000, "1GW-2GW", | |
IF(?capacity_in_Mw < 5000, "2GW-5GW", | |
IF(?capacity_in_Mw < 10000, "5GW-10GW", | |
IF(?capacity_in_Mw < 20000, "15GW-20GW", | |
">20GW"))))) | |
AS ?layer). | |
SERVICE wikibase:label { | |
bd:serviceParam wikibase:language "en" . | |
} | |
} | |
ORDER BY DESC(?capacity_in_Mw) | |
LIMIT 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment