{"id":17247639,"url":"https://github.com/joshdata/why-use-cartograms","last_synced_at":"2025-07-30T13:34:56.749Z","repository":{"id":66126381,"uuid":"51617133","full_name":"JoshData/why-use-cartograms","owner":"JoshData","description":"Analysis for a blog post on cartograms.","archived":false,"fork":false,"pushed_at":"2024-06-13T00:31:32.000Z","size":5016,"stargazers_count":29,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"primary","last_synced_at":"2025-04-14T05:51:53.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://medium.com/@joshuatauberer/4a98f89cbbb1#.ygy16f6hl","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoshData.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-02-12T21:19:05.000Z","updated_at":"2020-11-20T05:20:08.000Z","dependencies_parsed_at":"2025-04-14T05:32:10.364Z","dependency_job_id":"a85ffb4f-3899-4f11-a13e-432abd86d4e8","html_url":"https://github.com/JoshData/why-use-cartograms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JoshData/why-use-cartograms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshData%2Fwhy-use-cartograms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshData%2Fwhy-use-cartograms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshData%2Fwhy-use-cartograms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshData%2Fwhy-use-cartograms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoshData","download_url":"https://codeload.github.com/JoshData/why-use-cartograms/tar.gz/refs/heads/primary","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshData%2Fwhy-use-cartograms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267875777,"owners_count":24158782,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T06:38:30.663Z","updated_at":"2025-07-30T13:34:56.739Z","avatar_url":"https://github.com/JoshData.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quantifying how distorted population maps are\n\nhttps://medium.com/@joshuatauberer/4a98f89cbbb1#.ygy16f6hl\n\n***\n\nChoropleth maps that color-code geographies according to population statistics are distorted. Lots of space on the map to goes to rural settled areas (or totally unsettled areas!) and relatively little space is given to densely populated cities. As a result, we're seeing a distorted picture of the people the map is intending to represent.\n\nThat's nothing new. But I've quantified just how distorted these maps are.\n\nI rasterized each of the the 71,954 Census tracts and (in a separate analysis each of the 3,108 counties) in the contiguous United States with at least one resident and counted how many pixels each tract/county takes up in the final image. (Each tract/county takes up at least one pixel. When multiple tracts/counties are drawn on the same pixel, I apportioned the pixel equally to each of those tracks/counties. I rasterized to what would be an 800x500 pixel image of the contiguous United States.) Then I cross-referenced those pixels to the 2010-2014 American Community Survey 5-Year Estimates demographic data for the tracts/counties in those pixels.\n\n## How to reproduce this study\n\nGet a US Census API key from http://api.census.gov/data/key_signup.html. Then fetch Census demographic data (American Community Survey) and geospatial data (TIGER):\n\n\texport API_KEY=your_census_api_key_here\n\tpython3 fetch_demo_stats.py tract \u003e tract_population.csv\n\tpython3 fetch_demo_stats.py county \u003e county_population.csv\n\n\t./fetch_shapefiles.sh\n\nNow compute which pixels in a raster image correspond to which tracts/counties (for an 800-pixel-wide map):\n\n\tpython3 compute_pixels.py tract 800 \u003e tract_pixels_800.csv\n\tpython3 compute_pixels.py county 800 \u003e county_pixels_800.csv\n\nThis takes about an hour. The columns of `tract_pixels_800.csv` are the x and y coordinates of the pixel followed by the GEOIDs of as many tracts get drawn on that pixel as there are. (So, the rows of the CSV file don't all have the same number of columns.) The Python script also draws a composite raster map of all of the tracts in `map_tract_800.png`. Likewise for the county script.\n\nFinally run the analysis:\n\n\tpython3 analysis.py tract\n\tor\n\tpython3 analysis.py county\n\nwhich outputs some numbers for tract-based maps and county-based maps and saves some images.\n\nNote, these are all Python 3 scripts. Dependencies are listed in `pip-requirements.txt`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdata%2Fwhy-use-cartograms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshdata%2Fwhy-use-cartograms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshdata%2Fwhy-use-cartograms/lists"}