/** * csv_to_geojson.ts * * Convertir un fichier CSV en GeoJSON, en précisant les colonnes latitude et longitude * * Utilisation: * * npx ts-node csv_to_geojson.ts -d etalab_data/panneaux -f panneaux_limite_de_vitesse_fr_panoramax_detections.csv --latColumn 'GPSLatitude' --lonColumn 'GPSLongitude' -h * */ import fs from 'fs'; import path from 'path'; import minimist from 'minimist'; import { csvToGeoJSON, checkFile, countGeoJSONFeatures } from './csv_to_geojson.utils'; import { CSVConversionOptions } from './csv_to_geojson.utils'; // config des arguments de conversion const args = minimist(process.argv.slice(2), { alias: { dir: 'd', // dossier source file: 'f', // fichier source // infos pour un fichier CSV en source au lieu d'un fichier geojson latColumn: 'lat', // colonne latitude lonColumn: 'lon', // colonne longitude hasHeaders: 'h', // headers présents }, default: { hasHeaders: true, }, }); checkFile(args); csvToGeoJSON(args); countGeoJSONFeatures(args);