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.
You need to install the following modules:
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
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.
- optionally use TopoJSON instead of GeoJSON
- support for other file types like shapefile, tsv, etc.