Skip to content

Commit

Permalink
Merge pull request #404 from BaseAdresseNationale/jugurtha/source-nam…
Browse files Browse the repository at this point in the history
…es-optimization

Source Names Optimization
  • Loading branch information
jbouhadoun authored May 23, 2024
2 parents 18d6810 + d50c392 commit b197606
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/formatters/geojson.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ function compactObject(obj) {
return pickBy(obj, v => !isUndefined(v) && !isNull(v))
}

function replaceSourcePosition(sourcePosition) {
switch (sourcePosition) {
case 'ign-api-gestion-laposte':
return 'ign-api-gestion-municipal_administration'
case 'ign-api-gestion-sdis':
return 'ign-api-gestion-ign'
default:
return sourcePosition
}
}

function prepareAdresse(numero, voie) {
const replacedSourcePosition = replaceSourcePosition(numero.sourcePosition)

return feature(numero.position, compactObject({
id: numero.cleInterop,
numero: numero.numero,
Expand All @@ -17,7 +30,7 @@ function prepareAdresse(numero, voie) {
nomCommune: voie.nomCommune,
codeAncienneCommune: voie.codeAncienneCommune,
nomAncienneCommune: voie.nomAncienneCommune,
sourcePosition: numero.sourcePosition,
sourcePosition: replacedSourcePosition,
sourceNomVoie: voie.sourceNomVoie,
certifie: numero.certifie,
dateMAJ: numero.dateMAJ
Expand Down

0 comments on commit b197606

Please sign in to comment.