This webpage is an ongoing cartographic test. I want to map open data from data.gouv.fr. Ideally it would reproduce the same type of maps than in the excellent book "Le mystère français" from Hervé Le Bras and Emmanuel Todd and add interactivity by selecting datasets and available periods.
Cette page est un test de cartographie des données de l'INSEE. Idéalement elle devrait permettre de produire le même type de carte que celles de l'excellent livre "Le mystère français" de Hervé Le Bras et Emmanuel Todd et ajouter de l'interactivité en choisissant parmi les données et les périodes disponibles.
Infos : Map of France (from data.gouv.fr) at different administrative levels. Geographical data are contained in a single 9Mb TopoJSON file (see details). Click on the map to zoom to a geometry, double-click to zoom-out to the previous zoom level.
Infos : Carte de France (source: data.gouv.fr) à différents niveaux administratifs. Les données géographiques sont contenues dans un fichier TopoJSON unique de 9Mb (voir détails). Cliquez sur la carte pour zoomer sur une géométrie, double-cliquez pour revenir au zoom précédent.
I use shape files from data.gouv.fr (2015 version simplified at 100m). The problem with this file is that it weights 15.5 Mb so it's a long loading and that it isn't directly usable on github. I started by converting the .shp file into GeoJSON format using ogr2ogr from the Geospatial Data Abstraction Library (GDAL).
J'utilise des fichiers formes provenant de data.gouv.fr (version 2015 simplifiée à 100m). Le problème de ce fichier est qu'il pèse 15.5 Mb ce qui ralentit le chargement et le fait qu'il ne soit pas utilisable directement sur github. J'ai commencé par convertir le fichier .shp en GeoJSON en utilisant ogr2ogr de la librairie d'abstraction de données géospatiales (GDAL).
ogr2ogr -f GeoJSON -t_srs crs:84 geo.json communes-20150101-100m.shp
The GeoJSON file produced is even bigger (43.5 Mb), I then used TopoJSON to compress it and drastically reduce the file size (11 Mb!!) in order to minimize the loading time.
Le fichier GeoJSON obtenu est plus volumineux (43.5 Mb), j'utilise TopoJSON pour le compresser et ainsi réduire la taille du fichier (11 Mb!!) afin d'accélérer le chargement.
geo2topo -o topo.json -q 1e5 geo.json
I then deleted the attributes that I didn't needed (wikipedia, surf_m2 and nom) and I added the geographic codes corresponding to each geometry with a Python script. This increases slightly the size of the file (11.6 Mb), I finally simplified the topology with TopoJSON-simplify to obtain a final size of 9.6Mb.
J'ai ensuite retirer les attributs dont je n'avais pas besoin ("wikipedia", "surf_m2" et "nom") et j'ai rajouté l'appartenance géographique pour chaque commune à l'aide d'un script Python. Cela augmente légérement la taille du fichier (11.6 Mb), j'ai finalement simplifié la topologie avec TopoJSON-simplify pour obtenir un fichier de 9.6Mb.
toposimplify -o topo_s.json -p 1e-4 topo.json
Thanks to the geographic codes (and TopoJSON) we display different administrative levels ("communes" - "cantons" - "départements" - "régions") with the same data by merging geometries that have attributes in common.
Grâce aux attributs (et à TopoJSON) on affiche différents niveaux de résolutions (communes - cantons - départements - régions) avec les mêmes données en fusionnant les géométries qui ont des attributs en commun.