The map shows the first and second round results for the presidential elections in france. When the mouse pointer is over a department, the results for it appear in a tooltip. At the moment of the creation, only the first round was done, and the second round data will be added this Sunday after the results are published.
The map is created using the geoConicConformalFrance projection of the d3-composite-projections library.
Downloaded the data from Natural Earth(countries file) and run:
ogr2ogr -where "adm0_a3 = 'FRA' OR adm0_a3 = 'SPM' OR adm0_a3 = 'BLM' OR adm0_a3 = 'PYF' OR adm0_a3 = 'NCL' OR adm0_a3 = 'WLF'" france.shp ne_10m_admin_1_states_provinces.shp
shp2json france.shp > /tmp/france/france.geojson
geo2topo france.geojson > france.json
If you want a lighter file, run:
toposimplify -p 0.001 -f < france.json > france_simplidfied.json
###Edit names and regions:
The output file has some errors and different names that make the results file not matching all the departments:
Guyane française --> Guyane
Saint Berthélemy --> Saint-Martin/Saint-Barthélemy ->>Some problems utf8 edit the json
Haute-Rhin --> Haut-Rhin
Seien-et-Marne --> Seine-et-Marne
Meurhe-et-Moselle --> Meurthe-et-Moselle
Merge Saint-Pierre-et-Miquelon
Wallis-et-Futuna
Nouvelle Calédonie
Polynésie française
etc.
The results are downloaded from the French Wikipedia:
The script extract.py uses BeautifulSoup to transform the wikipedia tables into a nice json file readable by d3. It’s written in python 2.7