Skip to main content
100%

Comunidad Valenciana population

✓ Published0🌍 Public
LLuisSevillano
Last edited Oct 14, 2016
Created on Oct 14, 2016

This choropleth map visualizes the population density of census tracts in the Comunidad Valenciana, Spain. The map uses a threshold color scale to encode population per square mile, with darker reds indicating higher densities. The visualization is built with D3.js, using the `d3.geo.path` projection and the TopoJSON library to render the geographic data. The source data comes from the 2011 Spanish census, processed from shapefiles using GDAL and TopoJSON command-line tools.

AI-generated description

Source: Census data and shapefile Ine, municipios polygons datos.gob.

I used a bash script I to filter from government's files and get the shapefiles I would use:

Isolate Comunidad Valenciana census polygons

ogr2ogr \
  -where "CCA = '10'" \
  cv/shapes/CV.shp \
  cartografia_censo2011_nacional/SECC_CPV_E_20111101_01_R_INE.shp

Shame for municipios

ogr2ogr \
  -where "CODNUT2 = 'ES52'" \
  cv/shapes/munis.shp \
  recintos_municipales_inspire_peninbal_etrs89/recintos_municipales_inspire_peninbal_etrs89.shp

reproject each shapefile and export to GeoJSON

ogr2ogr \
  -f "GeoJSON" \
  -t_srs "EPSG:32630" \
  cv/shapes/census.json \
  cv/shapes/CV.shp
ogr2ogr \
  -f "GeoJSON" \
  -t_srs "EPSG:32630" \
  cv/shapes/munis.json \
  cv/shapes/munis.shp

Then I use QGIS to create an unique ID from several fields for each polygon to could join with the csv. Join the data, preserve some properties, simplify, and merge both shapefiles in one json. "The resulting TopoJSON file has the 2011 estimated population of each census tract as the population property, and the land area in square meters as the area property. We will divide one by the other and converting to square miles".

topojson \
  -e data.csv \
  --id-property CUSEC,cod \
  -p population=+t1_1,area=+Shape_area \
  -s 1 \
  --width 750 \
  --margin 10 \
  -o cv.json \
  -- cv/shapes/census.json cv/shapes/munis.json

This recipe is in the bash script in this gist repo.

Mostly everything comes from Mike's block.

gpl-3.0 Licensed

Similar vizzes