Skip to content

Instantly share code, notes, and snippets.

@DanielJWood
Created April 18, 2012 20:58
Show Gist options
  • Save DanielJWood/2416502 to your computer and use it in GitHub Desktop.
Save DanielJWood/2416502 to your computer and use it in GitHub Desktop.
UNOCHA data Processing notes

The UNOCHA data was mined from the UNOCHA website and saved locally as zipped Shp files. The following steps were taken for processing all admin and populated places files from raw data into tilemill.

  1. Unzip Shapefile
  2. Load into QGIS and save three versions of the file in different projections and file types; SQlite with WGS 84, Shapefile with WGS 84, and SQlite file Google Mercator. The first two are for data download purposes. The last one is for use in Tilemill.
  • Note: You can also reproject these files by using tools like the ogr2ogr tool in GDAL, but I decided that it was easier to view and save the data through a UI like QGIS.
  • Note: Not all files are named well in their raw forms. In general, admin 1 means the largest boundaries subnational boundaries, admin 2 means the next largest subnational boundaries, and so on.

For the following files, additional joins have to be made to create the final file:

Chad Population at the Admin 2 level

  • Open up the population_departement.xls file and save as a csv so that you can input into sqlite.
  • Create a copy of the Chad Admin 2 level WGS 84 sqlite file
  • Open this copy (keep the original separate) and also open the population_departement.csv. Look at the Nom du Departement column of the csv and the departmen column of the sqlite file. Cross check these columns to ensure the names are the same in each to use in the join (below)
  • Once all the names match up, and you know the join will work, add the population_departement.csv as a table.
  • Create table as a join between the departmen column of the WGS 84 sqlite file and the nom du department column of the population_departement table.
  • In your geometry_columns table in sqlite change the first entry in f_table_name (which should be something like ocha_chad_amdin2) to the name of your new table that contains both the Admin data and the population data. -
  • Drop the original table (ocha_chad_admin2 or something similar), so that you only have the new Admin2-population table.
  • Load this joined sqlite file into QGIS and resave as a Google Mercator Sqlite and a WGS 84 shapefile, so that you now have all three types (like step 2 above)

Mali Population at Admin level 1 and Maurtiania malnutrition admin level 1 follow the same steps as above. The exception is that the join columns do not need any editing in order to match up, 1 to 1. Its not a bad idea to double check before you run a join.

Once you have all these files, you are ready to load them into tilemill, style them, and upload them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment