Skip to content

Instantly share code, notes, and snippets.

@answerquest
Last active October 26, 2018 08:59
Show Gist options
  • Select an option

  • Save answerquest/ed9bdaae866559e136929703722aa150 to your computer and use it in GitHub Desktop.

Select an option

Save answerquest/ed9bdaae866559e136929703722aa150 to your computer and use it in GitHub Desktop.
Making choropleth maps without QGIS or coding

Jugaad recipe for making choropleth maps without QGIS or coding:

0. Software needed:

  • LibreOffice : an alternative to Microsoft Office. This is needed to open shapefile's attributes.
  • Some simple text editor. Preferably an advanced one like Notepad++, but just Notepad also will do.

Note: Steps 1,2 are if you have numerical data OUTSIDE of the shapefile that you want to render as horopleth. If your data is already INSIDE the shapefile, skip directly to step 3.

1. Have a shapefile.

If your data is not in ESRI shapefile (.shp and companion files) format, use : http://ogre.adc4gis.com to convert it to that.

2. Hack the shapefile

  • Find the ESRI format of your shape (ie the shapefile)
  • It has a collection of 6 or so files.
  • Of these, open the .dbf version with OpenOffice Calc (the alternative to Excel). You might also want to keep a backup copy of it on the side.
  • The attributes of the shapefile will open up as a table here.
  • HERE is where you can add in your data, in an additional column.
  • Take care not to re-order the rows here. Because there is no primary-key : The shapefile will read each row from this file and apply to its shapes in sequence. So if you sorted the rows or moved anything up or down, the attributes will get jumbled.
  • Look at the column headers. They specify format of the column at end.
  • example: "Place_Name,C,254" : char, 254 max length.
  • example: "Code1Inch,N,19,6" : number, 19 digits max and 6 decimals max
  • So, formulate your new column's name too. Note that the title of the column itself must not exceed 10 chars. So use a shortened name, and no spaces. Can use underscore (_) .

One technique of bringing in data: Suppose I do want to sort the rows by, say, name, because my data is also sorted in another table. A way of achieving that is : create a serial number column, assign 1,2,3.... . Then sort the whole thing the way you want. Then copy-paste your data in in a new column. Then sort the whole thing again by serial number, hence you restore the order back to original.

  • Once done, save the .dbf file.

3. Convert to Geojson

  • Now zip up the shapefile, and use http://ogre.adc4gis.com to convert it to .geojson.
  • After converting, you can test if your data made it in, by drag-dropping your geojson on http://geojson.io website. Click one of the shapes, the popup should have your imported data in it now.

4. Simplify shape (if needed)

For uploading on https://app.datawrapper.de, the .geojson file needs to be 2mb or lesser. If our shapefile is too big, we can simplify it. Load it on https://mapshaper.org and click simplify on top right.
Do trial and error to get the suitable output.

5. Upload on datawrapper

  • Create your account on https://app.datawrapper.de and start a new map, then load this shape (geojson).
  • As you proceed you will find options to color the blocks by an attribute value, make tooltips etc.
  • Publish it .
  • One con: datawrapper doesn't render this on a world map, so there's no tile bacgrounds. Just the shapes.

6. Example output

https://datawrapper.dwcdn.net/fayxI/2/


Alternatives

  • There are more jugaad ways up the mountain.

Google My Maps

  • This has tons of features for simple-level GIS work, and easier interface than most others.

Shapes data to CSV

Getting rid of unwanted polygons etc

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment