Name: ministere-interieur-elections-to-insee
Owner: FT Interactive News
Description: Generates a translation table of government commune to INSEE codes
Created: 2017-04-26 12:34:17.0
Updated: 2017-05-08 21:25:12.0
Pushed: 2017-05-08 17:04:56.0
Homepage: null
Size: 331
Language: TypeScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This repo generates a translation table mapping the weird coding scheme used by the French Ministère de L'Intérieur to the commonly-used INSEE codes predominantly used in geographical software.
Install:
m install ft-interactive/ministere-interieur-elections-to-insee --save
Require government-to-insee.json
in your code:
ES6 modules (Dependent upon transpiler/packager being able to import JSON):
rt * as translationTable from 'ministere-interieur-elections-to-insee';
CommonJS require()
:
t translationTable = require('ministere-interieur-elections-to-insee');
Check translation table for government code to get corresponding INSEE code:
t paris_1er_Arrondissement_INSEE = translationTable['75056AR01']; // Returns '75101'
It's inevitable that some boundary changes will occur before the next French election. To rebuild the table, you need to do a few things:
Clone repo:
t clone https://github.com/ft-interactive/ministere-interieur-elections-to-insee
Install dependencies:
npm:
m install
Yarn:
rn install
Download the latest versions of the commune and arrondissement shapefiles from: https://www.data.gouv.fr/en/datasets/decoupage-administratif-communal-francais-issu-d-openstreetmap/
You want the latest “Export simple” and “Arrondissements Municipaux” files.
Move the .shp and .dbf files from each zipfile into data/
Copy referencePR/listeregdptcom.xml
from http://elections.interieur.gouv.fr/ into data/
Create the JSON sources from the data:
m run convert-communes-shp && npm run convert-arrondissements-shp && npm run create-sources
m run create-table
data/possibly-dubious-codes
.