mapping-geojson-osm/build_departments.ts

183 lines
4.9 KiB
TypeScript

/**
build all files for departements from the dataset and the mapping engine
**/
const {exec} = require('child_process');
const execSync = require("child_process").execSync;
let min_department = 1;
const max_departement = 1
let enable_domtom = true;
// const max_departement = 95
function exec_command(command: string) {
console.log('=> command',
command
)
const result = execSync(command);
// convert and show the output.
console.log(result.toString("utf8"));
}
function build_department_geojson(department: string) {
let command = `ts-node convert_to_osm_tags.ts --department=${department}`;
console.log('command', command)
exec_command(command)
}
function convert_geojson_to_osm_for_department(department: string) {
let command = `geojsontoosm output/my_converted_data_set_filtered_zipcode_${department}.json > osm_output/bornes-irve-filetered-from-etalab-opendata_dep_${department}.osm`;
console.log('command', command)
exec_command(command)
}
for (let ii = min_department; ii <= max_departement; ii++) {
let departement = '' + ii
build_department_geojson(departement)
}
for (let ii = min_department; ii <= max_departement; ii++) {
let departement = '' + ii
convert_geojson_to_osm_for_department(departement)
}
// build_department_geojson('2A')
// convert_geojson_to_osm_for_department('2A')
// build_department_geojson('2B')
// convert_geojson_to_osm_for_department('2B')
if (enable_domtom) {
// départements corse et dom tom
let more_departements = ['2A', '2B'
, '971'
, '972'
, '973'
, '974'
, '975'
, '976']
more_departements.forEach((department => {
console.log(' mapping data for department ' + department)
let departement_string = '' + department
build_department_geojson(departement_string)
}))
more_departements.forEach((department => {
console.log('convert to osm ' + department)
let departement_string = '' + department
convert_geojson_to_osm_for_department(departement_string)
}))
}
/**
Numéro Départements Chef-lieu
01 Ain Bourg-en-Bresse
02 Aisne Laon
03 Allier Moulin
04 Alpes-de-Haute-Provence Digne
05 Hautes-Alpes Gap
06 Alpes-Maritimes Nice
07 Ardèche Privas
08 Ardennes Charleville-Mézières
09 Ariège Foix
10 Aube Troyes
11 Aude Carcassonne
12 Aveyron Rodez
13 Bouches-du-Rhône Marseille
14 Calvados Caen
15 Cantal Aurillac
16 Charente Angoulême
17 Charente-Maritime La Rochelle
18 Cher Bourges
19 Corrèze Tulle
21 Côte-d'Or Dijon
22 Côtes d'Armor Saint-Brieuc
23 Creuse Guéret
24 Dordogne Périgueux
25 Doubs Besançon
26 Drôme Valence
27 Eure Evreux
28 Eure-et-Loir Chartres
29 Finistère Quimper
30 Gard Nîmes
31 Haute-Garonne Toulouse
32 Gers Auch
33 Gironde Bordeaux
34 Hérault Montpellier
35 Ille-et-Vilaine Rennes
36 Indre Châteauroux
37 Indre-et-Loire Tours
38 Isère Grenoble
39 Jura Lons-le-Saunier
40 Landes Mont-de-Marsan
41 Loir-et-Cher Blois
42 Loire St-Étienne
43 Haute-Loire Le Puy
44 Loire-Atlantique Nantes
45 Loiret Orléans
46 Lot Cahors
47 Lot-et-Garonne Agen
48 Lozère Mende
49 Maine-et-Loire Angers
50 Manche St-Lô
51 Marne Châlons-sur-Marne
52 Haute-Marne Chaumont
53 Mayenne Laval
54 Meurthe-et-Moselle Nancy
55 Meuse Bar-le-Duc
56 Morbihan Vannes
57 Moselle Metz
58 Nièvre Nevers
59 Nord Lille
60 Oise Beauvais
61 Orne Alençon
62 Pas-de-Calais Arras
63 Puy-de-Dôme Clermont-Ferrand
64 Pyrénées-Atlantiques Pau
65 Hautes-Pyrénées Tarbes
66 Pyrénées-Orientales Perpignan
67 Bas-Rhin Strasbourg
68 Haut-Rhin Colmar
69 Rhône Lyon
70 Haute-Saône Vesoul
71 Saône-et-Loire Mâcon
72 Sarthe Le Mans
73 Savoie Chambéry
74 Haute-Savoie Annecy
75 Paris Paris
76 Seine-Maritime Rouen
77 Seine-et-Marne Melun
78 Yvelines Versailles
79 Deux-Sèvres Niort
80 Somme Amiens
81 Tarn Albi
82 Tarn-et-Garonne Montauban
83 Var Toulon
84 Vaucluse Avignon
85 Vendée La Roche-sur-Yon
86 Vienne Poitiers
87 Haute-Vienne Limoges
88 Vosges Épinal
89 Yonne Auxerre
90 Territoire de Belfort Belfort
91 Essonne Evry
92 Hauts-de-Seine Nanterre
93 Seine-St-Denis Bobigny
94 Val-de-Marne Créteil
95 Val-D'Oise Pontoise
2A Corse-du-Sud Ajaccio
2B Haute-Corse Bastia
971 Guadeloupe Basse-Terre
972 Martinique Fort-de-France
973 Guyane Cayenne
974 La Réunion Saint-Denis
976 Mayotte Mamoudzou
**/