{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "\n", "import pandas as pd\n", "import geopandas\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Case study - Conflict mapping: mining sites in eastern DR Congo\n", "\n", "In this case study, we will explore a dataset on artisanal mining sites located in eastern DR Congo.\n", "\n", "**Note**: this tutorial is meant as a hands-on session, and most code examples are provided as exercises to be filled in. I highly recommend actually trying to do this yourself, but if you want to follow the solved tutorial, you can find this in the `_solved` directory.\n", "\n", "---\n", "\n", "#### Background\n", "\n", "[IPIS](http://ipisresearch.be/), the International Peace Information Service, manages a database on mining site visits in eastern DR Congo: http://ipisresearch.be/home/conflict-mapping/maps/open-data/\n", "\n", "Since 2009, IPIS has visited artisanal mining sites in the region during various data collection campaigns. As part of these campaigns, surveyor teams visit mining sites in the field, meet with miners and complete predefined questionnaires. These contain questions about the mining site, the minerals mined at the site and the armed groups possibly present at the site.\n", "\n", "Some additional links:\n", "\n", "* Tutorial on the same data using R from IPIS (but without geospatial aspect): http://ipisresearch.be/home/conflict-mapping/maps/open-data/open-data-tutorial/\n", "* Interactive web app using the same data: http://www.ipisresearch.be/mapping/webmapping/drcongo/v5/" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Importing and exploring the data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### The mining site visit data\n", "\n", "IPIS provides a WFS server to access the data. We can send a query to this server to download the data, and load the result into a geopandas GeoDataFrame:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import requests\n", "import json\n", "\n", "wfs_url = \"http://geo.ipisresearch.be/geoserver/public/ows\"\n", "params = dict(service='WFS', version='1.0.0', request='GetFeature',\n", " typeName='public:cod_mines_curated_all_opendata_p_ipis', outputFormat='json')\n", "\n", "r = requests.get(wfs_url, params=params)\n", "data_features = json.loads(r.content.decode('UTF-8'))\n", "data_visits = geopandas.GeoDataFrame.from_features(data_features, crs={'init': 'epsg:4326'})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "However, the data is also provided in the tutorial materials as a GeoJSON file, so it is certainly available during the tutorial." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
Check the first section of the [04-more-on-visualization.ipynb](04-more-on-visualization.ipynb) notebook for tips and tricks to plot with GeoPandas.
\n", "For the following exercises, check the first section of the [04-more-on-visualization.ipynb](04-more-on-visualization.ipynb) notebook for tips and tricks to plot with GeoPandas.
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "