Skip to content

Commit

Permalink
get postal cities countries from pelias-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Lagouche committed May 18, 2021
1 parent f4a3e73 commit f8a81b3
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/postalCityMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const fs = require('fs');
const path = require('path');
const stable = require('stable');
const csv = require('csv-parse/lib/sync');
const { count } = require('console');
const config = require('pelias-config').generate();
const logger = require('pelias-logger').get('wof-admin-lookup');
const tsvOptions = {
Expand Down Expand Up @@ -49,16 +50,12 @@ const USA_ISO_CODES = ['USA','ASM','GUM','MNP','PRI','VIR'];
please open a Pull Request.
**/

// select which ISO country code files are loaded.
const tables = {
'ASM': loadTable('ASM'), // American Samoa
'GUM': loadTable('GUM'), // Guam
'MNP': loadTable('MNP'), // Northern Mariana Islands
'PRI': loadTable('PRI'), // Puerto Rico
'USA': loadTable('USA'), // Unites States of America
'VIR': loadTable('VIR'), // United States Virgin Islands
'NLD': loadTable('NLD'), // The Netherlands
};
const configPostalCitiesCountries = _.get(config, 'imports.adminLookup.postalCitiesCountries', ['ASM','GUM','MNP','PRI','USA','VIR','NLD']);

const tables = {};
configPostalCitiesCountries.forEach(country => {
tables[country] = loadTable(country);
});

// load the file format in to memory
function loadTable(cc){
Expand Down

0 comments on commit f8a81b3

Please sign in to comment.