Last active
August 3, 2018 14:24
-
-
Save thomas-maschler/1081fa93416583441650d5304bf916cd to your computer and use it in GitHub Desktop.
Total areas of combined restoration potential
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
{ | |
"$schema": "https://vega.github.io/schema/vega/v4.0.json", | |
"width": 240, | |
"height": 140, | |
"padding": 2, | |
"data": [ | |
{ | |
"name": "histogram", | |
"format": { | |
"property": "histograms[0].counts" | |
}, | |
"url": "https://production-api.globalforestwatch.org/v1/arcgis-proxy/ImageServer/computeHistograms?server=forest-atlas&service=eth/EthiopiaRestoration&pixelSize=30&renderingRule={\"rasterFunction\":\"Remap\",\"rasterFunctionArguments\":{\"Raster\":\"$6\"}}&geostore=ec04e30458b3f0c2aab1ec7428a41b21", | |
"transform": [ | |
{ | |
"type": "identifier", | |
"as": "id" | |
}, | |
{ | |
"type": "formula", | |
"as": "rounded", | |
"expr": "floor(datum.data*0.09/100)*100" | |
} | |
] | |
}, | |
{ | |
"name": "table", | |
"values": [ | |
{ | |
"id": "1", | |
"label": "No Data" | |
}, | |
{ | |
"id": "2", | |
"label": "Total Area" | |
} | |
], | |
"transform": [ | |
{ | |
"type": "lookup", | |
"from": "histogram", | |
"key": "id", | |
"fields": [ | |
"id" | |
], | |
"values": [ | |
"rounded" | |
], | |
"as": [ | |
"value" | |
] | |
}, | |
{ | |
"type": "filter", | |
"expr": "datum.value > 0" | |
}, | |
{ | |
"type": "formula", | |
"as": "group", | |
"expr": "1" | |
}, | |
{ | |
"type": "stack", | |
"groupby": [ | |
"group" | |
], | |
"sort": { | |
"field": "id" | |
}, | |
"field": "value" | |
} | |
] | |
} | |
], | |
"marks": [ | |
{ | |
"type": "rect", | |
"encode": { | |
"enter": { | |
"y": { | |
"signal": "height/5" | |
}, | |
"height": { | |
"signal": "height * 2 /3" | |
}, | |
"width": { | |
"signal": "3*width/4" | |
}, | |
"x": { | |
"signal": "width/8" | |
}, | |
"stroke": { | |
"value": "#448F30" | |
}, | |
"fill": { | |
"value": "white" | |
}, | |
"strokeWidth": { | |
"value": 4 | |
} | |
} | |
} | |
}, | |
{ | |
"type": "text", | |
"from": { | |
"data": "table" | |
}, | |
"encode": { | |
"enter": { | |
"x": { | |
"signal": "width/2" | |
}, | |
"y": { | |
"signal": "height/4 + 10" | |
}, | |
"align": { | |
"value": "center" | |
}, | |
"baseline": { | |
"value": "middle" | |
}, | |
"fontWeight": { | |
"value": "bold" | |
}, | |
"text": { | |
"value": "Total Area" | |
}, | |
"fontSize": { | |
"value": 14 | |
} | |
} | |
} | |
}, | |
{ | |
"type": "text", | |
"from": { | |
"data": "table" | |
}, | |
"encode": { | |
"enter": { | |
"x": { | |
"signal": "width/2" | |
}, | |
"y": { | |
"signal": "height/4 + 25" | |
}, | |
"align": { | |
"value": "center" | |
}, | |
"baseline": { | |
"value": "middle" | |
}, | |
"text": { | |
"value": "with Combined Potential" | |
}, | |
"fontSize": { | |
"value": 14 | |
} | |
} | |
} | |
}, | |
{ | |
"type": "text", | |
"from": { | |
"data": "table" | |
}, | |
"encode": { | |
"enter": { | |
"x": { | |
"signal": "width/2" | |
}, | |
"y": { | |
"signal": "height/4 + 55" | |
}, | |
"align": { | |
"value": "center" | |
}, | |
"fontSize": { | |
"value": 20 | |
}, | |
"fontWeight": { | |
"value": "bold" | |
}, | |
"baseline": { | |
"value": "middle" | |
}, | |
"text": { | |
"signal": "format(datum.value, ',') + ' ha'" | |
}, | |
"fill": { | |
"value": "#448F30" | |
} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment