All Projects → LokiTechnologies → Equalareacartogram

LokiTechnologies / Equalareacartogram

Licence: mit
Converts a Shapefile, GeoJSON, or CSV to an equal area cartogram

Projects that are alternatives of or similar to Equalareacartogram

Visualization Of Global Terrorism Database
📊 Visualization of GTD with py Plotly lib, including amazing graphs and animation 📼
Stars: ✭ 16 (-76.47%)
Mutual labels:  jupyter-notebook, data-visualization
Deep learning projects
Stars: ✭ 28 (-58.82%)
Mutual labels:  jupyter-notebook, data-visualization
Datadoubleconfirm
Simple datasets and notebooks for data visualization, statistical analysis and modelling - with write-ups here: http://projectosyo.wix.com/datadoubleconfirm.
Stars: ✭ 24 (-64.71%)
Mutual labels:  jupyter-notebook, data-visualization
Asteroids atlas of space
Code, data, and instructions for mapping orbits of asteroids in the solar system
Stars: ✭ 668 (+882.35%)
Mutual labels:  jupyter-notebook, cartography
Data Science Lunch And Learn
Resources for weekly Data Science Lunch & Learns
Stars: ✭ 49 (-27.94%)
Mutual labels:  jupyter-notebook, data-visualization
Cookbook 2nd
IPython Cookbook, Second Edition, by Cyrille Rossant, Packt Publishing 2018
Stars: ✭ 704 (+935.29%)
Mutual labels:  jupyter-notebook, data-visualization
Pygtc
Make a sweet giant triangle confusogram (GTC) plot
Stars: ✭ 13 (-80.88%)
Mutual labels:  jupyter-notebook, data-visualization
Py d3
D3 block magic for Jupyter notebook.
Stars: ✭ 428 (+529.41%)
Mutual labels:  jupyter-notebook, data-visualization
Drugs Recommendation Using Reviews
Analyzing the Drugs Descriptions, conditions, reviews and then recommending it using Deep Learning Models, for each Health Condition of a Patient.
Stars: ✭ 35 (-48.53%)
Mutual labels:  jupyter-notebook, data-visualization
Satellite imagery analysis
Implementation of different techniques to find insights from the satellite data using Python.
Stars: ✭ 31 (-54.41%)
Mutual labels:  jupyter-notebook, data-visualization
Qs ledger
Quantified Self Personal Data Aggregator and Data Analysis
Stars: ✭ 559 (+722.06%)
Mutual labels:  jupyter-notebook, data-visualization
Ds and ml projects
Data Science & Machine Learning projects and tutorials in python from beginner to advanced level.
Stars: ✭ 56 (-17.65%)
Mutual labels:  jupyter-notebook, data-visualization
Cookbook 2nd Code
Code of the IPython Cookbook, Second Edition, by Cyrille Rossant, Packt Publishing 2018 [read-only repository]
Stars: ✭ 541 (+695.59%)
Mutual labels:  jupyter-notebook, data-visualization
Facets
Visualizations for machine learning datasets
Stars: ✭ 6,744 (+9817.65%)
Mutual labels:  jupyter-notebook, data-visualization
Courses
Quiz & Assignment of Coursera
Stars: ✭ 454 (+567.65%)
Mutual labels:  jupyter-notebook, data-visualization
Data Science On Gcp
Source code accompanying book: Data Science on the Google Cloud Platform, Valliappa Lakshmanan, O'Reilly 2017
Stars: ✭ 864 (+1170.59%)
Mutual labels:  jupyter-notebook, data-visualization
Data Science
Collection of useful data science topics along with code and articles
Stars: ✭ 315 (+363.24%)
Mutual labels:  jupyter-notebook, data-visualization
Bap
Bayesian Analysis with Python (Second Edition)
Stars: ✭ 379 (+457.35%)
Mutual labels:  jupyter-notebook, data-visualization
Kepler.gl
Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
Stars: ✭ 8,231 (+12004.41%)
Mutual labels:  jupyter-notebook, data-visualization
Metrotwitter
What Twitter reveals about the differences between cities and the monoculture of the Bay Area
Stars: ✭ 52 (-23.53%)
Mutual labels:  jupyter-notebook, data-visualization

EqualAreaCartogram

A Python script that converts a Shapefile, GeoJSON, or CSV to an equal area cartogram SVG or GeoJSON

TL;DR

Python script for creating Equal-Area Hexagonal Cartograms.

Example Dense Hexmap

Installation

pip install --upgrade git+https://github.com/rishsriv/EqualAreaCartogram/

Usage

from eqcart import Cartogram
#input_filepath can be the location of a GeoJSON, SHP, CSV, or Excel File
cart = Cartogram(input_filepath, name_of_column_w_unique_ids, num_x_grid, num_y_grid)
cart.make_hex_svg(output_filepath) #for creating SVG
cart.make_hex_geojson(output_filepath) #for creating GeoJSON

For more details on usage, see this notebook

Requirements

pandas
geopandas

Contact

Send an email at [email protected] or tweet at @srivrish if you have any questions.

Input

The input file can be any of the following formats:

  • CSV/Excel*
  • SHP
  • GeoJSON

*if a csv or excel file is used as input, latitude and longitude columns that represent the latitude and longitude of each area must be present. If you do not know what the latitude and longitude of each area are, use this handy Google Spreadsheets tool and export the end result as a CSV.

Heuristic

For details on implementation, see this notebook

  1. Get the x_coord (latitude) and y_coord (longitude) of each area
  2. Normalize the x_coords and y_coords to align all points into a rectangular grid with a length and width that you define. This will create a matrix that is something like the image below

Pre-Shunt Grid

  1. If a bin (i.e., an x-y coordinate pair) has more than 1 point, select a point from the bin and shunt it to a neighbouring bin if neighbouring bin is empty. If no neighbouring bin is empty find a direction (up, down, left, or right) with the most proportion of empty spaces, shift all existing points in that direction by 1, and then move the selected point into that direction

  2. Iterate 3. until all bins only have 1 point in them. This will lead to a matrix that is something like the image below Post-Shunt Grid

  3. Convert the matrix obtained from point 4 into an SVG or GeoJSON with hexagon polygons. The code for this is based on the excellent chorogrid library by David Taylor. Hex Map

Motivation

Choropleths fail to adequately highlight geographically small areas. This becomes particularly pertinent when covering elections, where each constituency has the same weight regardless of its geographical size. Equal area cartograms solve this problem, and have been used fairly effectively by a number of news organizations - as shown in the image below (taken from Richard Brath's excellent blog

Equal Area Cartogram UK

However, making equal area cartograms can be a time consuming process - particularly for relatively obscure regions where well-designed SVGs of equal area cartograms are not easily available. While there is an R implementation for producing these, I could not find a Python implementation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].