Skip to main content

Compute continous cartograms (anamorphic maps)

Project description

Compute continous cartograms (anamorphic maps)

This is a Python package to compute cartograms from geopandas.GeoDataFrames, using the algorithm presented in Dougenik et al. (1985). It is the ‘sister project’ and Python implementation of our QGIS plugin which continues to be available.

Installation

cartogram is available from the PyPi package repository, install it, for instance, using pip:

pip install cartogram

Quick start

Input data

You will need a polygon data set in any format readable by geopandas that features a numeric attribute column to use as the relative target values to base the cartogram distortion on.

If you want to have a quick try-out, see the population data for Austrian provinces in the tests/data directory of this repository.

Cartogram creation

import cartogram
import geopandas

df = geopandas.read_file("input-data.gpkg")
c = cartogram.Cartogram(df, column="population")

c.to_file("output-data.gpkg")

Documentation

Find more detailed examples and an API reference at https://python-cartogram.readthedocs.io/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cartogram-0.0.2.tar.gz (17.8 kB view hashes)

Uploaded Source

Built Distribution

cartogram-0.0.2-py3-none-any.whl (17.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page