Skip to content
Choropy is a little python script that helps you generate GeoJSON for choropleth maps with jenks natural breaks.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
choro.py
example.png
requirements.txt

README.md

Choropy

Choropy is a little python script that helps you generate GeoJSON for choropleth maps with jenks natural breaks. Optionally it saves a HTML-file with a functional choropleth-map written in d3.js. You can choose between a blue, a red and a green color scheme.

All you need to do is provide a csv-file and a GeoJSON-file. The script does nearly all the work for you. Afterwards you probably need to change scaling, some headlines, the clicked-function and some styling.

example

Requirements

You need to install the following modules:

  • argparse
  • pandas
  • geopandas
  • numpy
  • jenkspy

I recommend using Anaconda/Miniconda.

conda install -c conda-forge argparse pandas geopandas numpy jenkspy

Or just install the requirements.txt with

conda install --file requirements.txt

Usage

The script needs a data file with the flag -i and a geojson file with the flag -j

python choro.py -i data.csv -j shape.json

Of course the files need to have a shared key so they can be merged. You need to specify this variable throughout the process.

To Do

  • optionally use TopoJSON instead of GeoJSON
  • support for other file types like shapefile, tsv, etc.
You can’t perform that action at this time.