Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sgibbes/9f834a4cb51b400713877cfd08229fa6 to your computer and use it in GitHub Desktop.
Save sgibbes/9f834a4cb51b400713877cfd08229fa6 to your computer and use it in GitHub Desktop.
This is an example of how to return annual forest loss statistics within Indonesia by querying the GFW API. I'll show all possible boundaries to query by, and an example of looking at forest loss within Indonesia Primary Forest
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 153,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"from pprint import pprint\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 154,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'dataset': '499682b1-3174-493f-ba1a-368b4636708e'}"
]
},
"execution_count": 154,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# The data on country pages is stored in this table: \n",
"{'dataset': '499682b1-3174-493f-ba1a-368b4636708e'}"
]
},
{
"cell_type": "code",
"execution_count": 155,
"metadata": {},
"outputs": [],
"source": [
"# create the url to query the data\n",
"url = 'https://production-api.globalforestwatch.org/v1/query/499682b1-3174-493f-ba1a-368b4636708e?'\n",
"sql = 'SELECT polyname from data GROUP BY polyname'"
]
},
{
"cell_type": "code",
"execution_count": 156,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{u'data': [{u'polyname': u'gadm28'},\n",
" {u'polyname': u'wdpa'},\n",
" {u'polyname': u'kba'},\n",
" {u'polyname': u'mining'},\n",
" {u'polyname': u'plantations'},\n",
" {u'polyname': u'landmark'},\n",
" {u'polyname': u'mangroves'},\n",
" {u'polyname': u'plantations__mining'},\n",
" {u'polyname': u'ifl_2013'},\n",
" {u'polyname': u'aze'},\n",
" {u'polyname': u'ifl_2013__wdpa'},\n",
" {u'polyname': u'mangroves__wdpa'},\n",
" {u'polyname': u'mangroves__kba'},\n",
" {u'polyname': u'plantations__wdpa'},\n",
" {u'polyname': u'ifl_2013__kba'},\n",
" {u'polyname': u'tiger_cl'},\n",
" {u'polyname': u'plantations__kba'},\n",
" {u'polyname': u'plantations__idn_forest_moratorium'},\n",
" {u'polyname': u'plantations__idn_mys_peatlands'},\n",
" {u'polyname': u'plantations__oil_palm'},\n",
" {u'polyname': u'ifl_2013__landmark'},\n",
" {u'polyname': u'managed_forests'},\n",
" {u'polyname': u'plantations__wood_fiber'},\n",
" {u'polyname': u'plantations__tiger_cl'},\n",
" {u'polyname': u'primary_forest'},\n",
" {u'polyname': u'idn_forest_moratorium'},\n",
" {u'polyname': u'mangroves__landmark'},\n",
" {u'polyname': u'ifl_2013__mining'},\n",
" {u'polyname': u'primary_forest__idn_forest_moratorium'},\n",
" {u'polyname': u'primary_forest__wdpa'},\n",
" {u'polyname': u'primary_forest__kba'},\n",
" {u'polyname': u'mangroves__mining'},\n",
" {u'polyname': u'ifl_2013__tiger_cl'},\n",
" {u'polyname': u'ifl_2013__managed_forests'},\n",
" {u'polyname': u'plantations__managed_forests'},\n",
" {u'polyname': u'oil_palm'},\n",
" {u'polyname': u'idn_mys_peatlands'},\n",
" {u'polyname': u'mangroves__idn_forest_moratorium'},\n",
" {u'polyname': u'ifl_2013__aze'},\n",
" {u'polyname': u'wood_fiber'},\n",
" {u'polyname': u'plantations__landmark'},\n",
" {u'polyname': u'ifl_2013__idn_forest_moratorium'},\n",
" {u'polyname': u'primary_forest__managed_forests'},\n",
" {u'polyname': u'primary_forest__oil_palm'},\n",
" {u'polyname': u'primary_forest__wood_fiber'},\n",
" {u'polyname': u'mangroves__aze'},\n",
" {u'polyname': u'primary_forest__idn_mys_peatlands'},\n",
" {u'polyname': u'plantations__aze'},\n",
" {u'polyname': u'mangroves__idn_mys_peatlands'},\n",
" {u'polyname': u'ifl_2013__oil_palm'},\n",
" {u'polyname': u'primary_forest__tiger_cl'},\n",
" {u'polyname': u'mangroves__oil_palm'},\n",
" {u'polyname': u'mangroves__managed_forests'},\n",
" {u'polyname': u'primary_forest__aze'},\n",
" {u'polyname': u'ifl_2013__wood_fiber'},\n",
" {u'polyname': u'mangroves__tiger_cl'},\n",
" {u'polyname': u'ifl_2013__idn_mys_peatlands'},\n",
" {u'polyname': u'mangroves__wood_fiber'},\n",
" {u'polyname': u'primary_forest__landmark'},\n",
" {u'polyname': u'primary_forest__mining'}],\n",
" u'meta': {u'cloneUrl': {u'body': {u'dataset': {u'application': [u'your',\n",
" u'apps'],\n",
" u'datasetUrl': u'/v1/query/499682b1-3174-493f-ba1a-368b4636708e?sql=SELECT%20polyname%20from%20data%20GROUP%20BY%20polyname'}},\n",
" u'http_method': u'POST',\n",
" u'url': u'/v1/dataset/499682b1-3174-493f-ba1a-368b4636708e/clone'}}}\n"
]
}
],
"source": [
"# send request to the api using specific sql string\n",
"properties = {'sql': sql}\n",
"r = requests.get(url, params = properties)\n",
"\n",
"# this returns all possible boundaries that data can be summarized by\n",
"pprint(r.json())"
]
},
{
"cell_type": "code",
"execution_count": 157,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{u'data': [{u'area': 745229.7349489555,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2001},\n",
" {u'area': 856933.7275843099,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2002},\n",
" {u'area': 545401.5946592465,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2003},\n",
" {u'area': 1290529.9424487203,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2004},\n",
" {u'area': 1184006.661106944,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2005},\n",
" {u'area': 1434923.6626982987,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2006},\n",
" {u'area': 1388837.0555543378,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2007},\n",
" {u'area': 1397189.6777070984,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2008},\n",
" {u'area': 1946559.7092499286,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2009},\n",
" {u'area': 1280661.4490504116,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2010},\n",
" {u'area': 1544765.5635640025,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2011},\n",
" {u'area': 2262183.5242625773,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2012},\n",
" {u'area': 1140017.9056999013,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2013},\n",
" {u'area': 1896862.4773496017,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2014},\n",
" {u'area': 1748403.016772665,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2015},\n",
" {u'area': 2424111.9581938162,\n",
" u'iso': u'IDN',\n",
" u'polyname': u'gadm28',\n",
" u'year': 2016}],\n",
" u'meta': {u'cloneUrl': {u'body': {u'dataset': {u'application': [u'your',\n",
" u'apps'],\n",
" u'datasetUrl': u'/v1/query/499682b1-3174-493f-ba1a-368b4636708e?sql=SELECT%20polyname%2C%20year_data.year%20as%20year%2C%20SUM%28year_data.area_loss%29%20as%20area%20FROM%20data%20WHERE%20polyname%20%3D%20%27gadm28%27%20AND%20iso%20%3D%20%27IDN%27%20AND%20thresh%3D%2030%20GROUP%20BY%20polyname%2C%20iso%2C%20nested%28year_data.year%29'}},\n",
" u'http_method': u'POST',\n",
" u'url': u'/v1/dataset/499682b1-3174-493f-ba1a-368b4636708e/clone'}}}\n"
]
}
],
"source": [
"# Now, to query loss within Indonesia: Specify gadm28 as the polyname and IDN as the iso:\n",
"sql = \"SELECT polyname, year_data.year as year, SUM(year_data.area_loss) as area FROM data WHERE polyname = 'gadm28' AND iso = 'IDN' AND thresh= 30 GROUP BY polyname, iso, nested(year_data.year)\"\n",
"\n",
"properties = {'sql': sql}\n",
"r = requests.get(url, params = properties)\n",
"\n",
"pprint(r.json())\n"
]
},
{
"cell_type": "code",
"execution_count": 158,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" area iso polyname year\n",
"0 7.452297e+05 IDN gadm28 2001\n",
"1 8.569337e+05 IDN gadm28 2002\n",
"2 5.454016e+05 IDN gadm28 2003\n",
"3 1.290530e+06 IDN gadm28 2004\n",
"4 1.184007e+06 IDN gadm28 2005\n"
]
},
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x10eb2f250>"
]
},
"execution_count": 158,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAEmCAYAAACnG32nAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xu8VVW99/HPV0TR8IJKhILhU6SoJygQKCtNU9AsvB3TY4qaWkfNerLSY70eLfNkzykrOmUPKkcpTz4ezEtlEV7QOoIBKgpeghRjKypxURFJwN/5Y46ti83atznWZrFZ3/frNV97rjHn/I0x19pr/ta8jamIwMzMLMdW9W6AmZl1f04mZmaWzcnEzMyyOZmYmVk2JxMzM8vmZGJmZtmcTMzqQNKeklZJ6tHGPCHp3a1MO1nS77uuha22aVBq19abuu5Uf7vvm9WHk4l1mqRFkl5LX+rmYfdNWH+7GzRJl0r6+aZqU2dFxF8jondErAeQNF3SmZ1Y/oaIOLxM3Zv7e9OWlu+bbT6cTKysT6QvdfPwXGcWrtcvWzPrGk4mVlOSPilpvqSV6df2kIppiyRdKOkR4FVJW0vaXdLNkpZKelrS+RXzj5Q0W9LLkl6QdG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hTORT4dkT8v8qZUhcXHwM+EBGrJU0HeqXJayJi/aZqsFkZPsxl1rVuAcZS7JFMTcMZknoDSNpD0tuBnYAVKZHsA4yuV4PNyvCeiVkXiojXJd0DrEx7F7+XNASYIQlgFfBp4HfA5yQ9TtFd+Mx6tdmsDHenYtaF0on3B4F/jIgF9W6PWVfxYS6zLiJpX2AhcJcTiW3pvGdiZmbZvGdiZmbZnEzMzCybk4mZmWVzMjEzs2xOJmZmls3JxMzMsv0PD8Wn8RbxGjcAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10dcc3e50>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create a plot of loss data within Indonesia\n",
"\n",
"# load into pandas dataframe\n",
"idn_loss = pd.DataFrame(r.json().get('data'))\n",
"print idn_loss.head()\n",
"\n",
"# plot the dataframe\n",
"idn_loss.plot(x='year', y='area', kind='bar', color='#FE5A8D', title='Forest Loss within Indonesia')\n"
]
},
{
"cell_type": "code",
"execution_count": 159,
"metadata": {},
"outputs": [],
"source": [
"# Now, to query loss within Indonesia's Primary Forest: Specify primary_forest as the polyname and IDN as the iso:\n",
"\n",
"sql = \"SELECT polyname, year_data.year as year, SUM(year_data.area_loss) as area FROM data WHERE polyname = 'primary_forest' AND iso = 'IDN' AND thresh= 30 GROUP BY polyname, iso, nested(year_data.year)\"\n",
"\n",
"properties = {'sql': sql}\n",
"prf_request = requests.get(url, params = properties)\n"
]
},
{
"cell_type": "code",
"execution_count": 160,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" area iso polyname year\n",
"0 208336.702883 IDN primary_forest 2001\n",
"1 278416.723108 IDN primary_forest 2002\n",
"2 240911.253722 IDN primary_forest 2003\n",
"3 478764.061310 IDN primary_forest 2004\n",
"4 488863.596515 IDN primary_forest 2005\n"
]
},
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x10e04ead0>"
]
},
"execution_count": 160,
"metadata": {},
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ZJWUtx/Y0+Kq8g6pmM6Zs/HbIQ2NnvMLXVXF6dRH8CBwDtI90+oKJ/qmI7pmPWJ2QhtbPaYW9TRXYEa8QGcAzxGcXn4J4FpFfPudUzHdMyej9kIbWz2mDXr6a5Ajfhg293RzTEd0zFLxmyENjZ7zFqPZr+cyra4o5tjOqZj5sVshDY2e8wtK+muQA3qORWX+QaKO7oB76a433bZO7o5pmM6Zl7MRmhjs8fcUnd1cRrxQXFviDe0M+9Ix3RMx+z5mI3QxmaPWevha3OZmVm2Zh/mMjOzbuBkYmZm2ZxMzMwsm5OJWQOR1KvebTCrxcnEbBuR9BVJn6p4frGkcyV9VtJ8SQ9K+qeK+TdIWihpkaSzKsrXSvoXSQ8AR/TwyzDbKk4mZtvOTIr7tSNpJ+BE4FlgFHA4cAgwTtJb0/IfjohxwHjgHEmDU/muwD0RMTYiftuTL8BsazX7f8CbbTNR/LfxCklvAfYG7gMOA45O0wADKJLLXRQJ5G9T+b6pfAXwCvDTnmy7WVc5mZhtW1cApwFvoOipTAa+HhH/VrlQusTFO4AjImK9pDlAvzR7Q0S80lMNNivDw1xm29bPgakUPZJb0uPDkgYASBom6c+APYBVKZEcCEysV4PNynDPxGwbioiXJd0BrE69i19LGg3MlQSwFvgg8Cvgo5IWU1wufF692mxWhi+nYrYNpQPv9wIfiIgl9W6P2bbiYS6zbUTSGGApcJsTie3o3DMxM7Ns7pmYmVk2JxMzM8vmZGJmZtmcTMzMLJuTiZmZZXMyMTOzbP8LbcHp5489z9sAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10e518e90>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Create a plot of loss data within Indonesia's Primary Forest\n",
"\n",
"# load into pandas dataframe\n",
"prf_loss = pd.DataFrame(prf_request.json().get('data'))\n",
"print prf_loss.head()\n",
"\n",
"# plot the dataframe\n",
"prf_loss.plot(x='year', y='area', kind='bar', color='#FE5A8D', title=\"Forest Loss within Indonesia's Primary Forest\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment