diff --git a/.env.dist b/.env.dist index 785a04f..fd3cfe2 100644 --- a/.env.dist +++ b/.env.dist @@ -56,6 +56,26 @@ MAX_DETOUR_DURATION_RATIO=0.3 GEOROUTER_TYPE=graphhopper GEOROUTER_URL=http://localhost:8989 +# GEOCODER +# default language +GEOCODER_LANG=fr +# minimal score to consider a result as valid +GEOCODEr_MIN_CONFIDENCE=0.5 +# max number of results per provider (input results) +GEOCODER_MAX_RESULTS_PER_PROVIDER=5 +# max number of results per address type (output results) +GEOCODER_MAX_RESULTS_PER_TYPE=5 +# sanitize results ? +GEOCODER_SANITIZE=true +# consolidate results ? +GEOCODER_CONSOLIDATE=true +# max distance in km between 2 points to consider a duplicate +GEOCODER_PROXIMITY=5 +# population vs distance prioritizer coef +# "boost" population weight for results with a short distance +# => multiply the population by COEF / distance (in km) +GEOCODDER_POPULATION_PRIORITIZER_COEF=100 + # PAGINATION # number of results per page PER_PAGE=10 diff --git a/src/config/geography.config.ts b/src/config/geography.config.ts index d36cada..564a599 100644 --- a/src/config/geography.config.ts +++ b/src/config/geography.config.ts @@ -4,9 +4,49 @@ import { Config } from './config'; export interface GeographyConfig extends Config { georouterType: string; georouterUrl: string; + geocoderLang: string; + geocoderMinConfidence: number; + geocoderMaxResultsPerProvider: number; + geocoderMaxResultsPerType: number; + geocoderSanitize: boolean; + geocoderConsolidate: boolean; + geocoderProximity: number; + geocoderPopulationPrioritizerCoef: number; + geocoderProviders: string[]; + geocoderProvidersFallback: string[]; } export default registerAs('geography', () => ({ georouterType: process.env.GEOROUTER_TYPE ?? 'graphhopper', georouterUrl: process.env.GEOROUTER_URL ?? 'http://localhost:8989', + geocoderLang: process.env.GEOCODER_LANG ?? 'fr', + geocoderMinConfidence: process.env.GEOCODER_MIN_CONFIDENCE + ? parseFloat(process.env.GEOCODER_MIN_CONFIDENCE) + : 0.5, + geocoderMaxResultsPerProvider: process.env.GEOCODER_MAX_RESULTS_PER_PROVIDER + ? parseInt(process.env.GEOCODER_MAX_RESULTS_PER_PROVIDER) + : 5, + geocoderMaxResultsPerType: process.env.GEOCODER_MAX_RESULTS_PER_TYPE + ? parseInt(process.env.GEOCODER_MAX_RESULTS_PER_TYPE) + : 5, + geocoderSanitize: process.env.GEOCODER_SANITIZE + ? process.env.GEOCODER_SANITIZE === 'false' + ? false + : true + : true, + geocoderConsolidate: process.env.GEOCODER_CONSOLIDATE + ? process.env.GEOCODER_CONSOLIDATE === 'false' + ? false + : true + : true, + geocoderProximity: process.env.GEOCODER_PROXIMITY + ? parseInt(process.env.GEOCODER_PROXIMITY) + : 5, + geocoderPopulationPrioritizerCoef: process.env + .GEOCODER_POPULATION_PRIORITIZER_COEF + ? parseInt(process.env.GEOCODER_POPULATION_PRIORITIZER_COEF) + : 100, + geocoderProviders: + process.env.GEOCODER_PROVIDERS ?? 'ADDOK,PELIAS_SEARCH,PELIAS_AUTOCOMPLETE', + geocoderProvidersFallback: process.env.GEOCODER_PROVIDERS_FALLBACK ?? 'GMAPS', }));