add toulouse ask angela, fix output name

This commit is contained in:
Tykayn 2024-10-17 10:47:43 +02:00 committed by tykayn
parent a41fd19c35
commit 2348d4f3e6
5 changed files with 6433 additions and 4375 deletions

View File

@ -18,7 +18,6 @@ import MappingArbresIssy from "./mappings/converters/configArbresIssy";
import MappingArbres92 from "./mappings/converters/configArbresHautsDeSeine";
import MappingMuseums from "./mappings/converters/configMuseums";
import MappingRouenPAV from "./mappings/converters/configRouen_PAV";
import MappingAskAngela from "mappings/converters/configAskAngela";
const limitWarningPercentageChangeInPoints = 5; // show a warning when more than N percent of the number of points changed
const allowed_configs = [
@ -29,6 +28,7 @@ const allowed_configs = [
];
import minimist = require('minimist');
import MappingAskAngela from "./mappings/converters/configAskAngela";
const debugLog = utils.debugLog;
@ -77,6 +77,9 @@ if (mini_arguments['engine-config']) {
let Mapping_engine: any;
let outname = 'converted_'
if (mini_arguments['output-file']) {
outname = mini_arguments['output-file'];
}
if (mini_arguments['outname']) {
outname = mini_arguments['outname'];
}
@ -125,8 +128,11 @@ let output_folder = 'output';
* @param fileContent
*/
function writeFile(fileName: string, fileContent: any) {
if(outname){
fileName = ''+outname;
}
let write_path = `./${output_folder}/${fileName}`
debugLog("write file \n", outname + fileName, write_path)
debugLog("write file \n", fileName, write_path)
console.log("-------- write file \n", fileName, "\n", write_path)
@ -198,7 +204,36 @@ function convertDataFromSource(sourceFilePath: string, mapping: MappingConfigTyp
let regex_filter_test_result = true
let remove_original_key = false;
feature_point.properties.tags?.forEach((tagKey: string, tagValue: string) => {
// fix des jeux de données qui ne sont pas des geojson
let properties_list:any = Object.keys(feature_point)
if(feature_point.geo_point_2d){
feature_point["type"] = "Feature"
feature_point["geometry"]={
"coordinates": feature_point.geo_point_2d[0],
"type": "Point"
}
}
if(feature_point['properties']){
properties_list = feature_point.properties
if(feature_point.properties['tags']){
properties_list = feature_point.properties.tags
}
}
if(!feature_point["properties"]){
let properties_list_to_move:any = Object.keys(feature_point)
feature_point["properties"] = {}
properties_list_to_move.forEach((tagKey: string, tagValue: any)=> {
feature_point["properties"][tagKey] = feature_point[tagKey]
})
}
properties_list?.forEach((tagKey: string, tagValue: string) => {
if (mapping.filters && mapping.filters.exclude_point_if_tag_not_empty?.indexOf(tagKey) !== -1
&& tagValue.length
&& tagValue !== 'null') {

View File

@ -4,7 +4,7 @@ Les commerces et autres lieux adhérant au dispositif
# Conversion
## Conversion des données de Toulouse
```bash
ts-node convert_to_osm_tags.ts --source=etalab_data/ask_angela/toulouse_askangela.json --output-file=toulouse_askangela.json --engine-config=MappingAskAngela
ts-node convert_to_osm_tags.ts --source=etalab_data/askangela/toulouse_askangela.json --output-file=toulouse_askangela.json --engine-config=MappingAskAngela
```
## Conversion des données de Bordeaux

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ const MappingAskAngela: MappingConfigType = {
},
filters: {
// exclude_point_if_tag_not_empty: ['id_osm'], // on peut exclure des données converties celles qui sont déjà avec un identifiant openstreetmap afin de favoriser l'intégration san avoir à gérer les doublons
// offset: 50
// offset: 1
},
add_not_mapped_tags_too: false,
boolean_keys: [],

File diff suppressed because it is too large Load Diff