pelias / wof-admin-lookup

Who's on First Admin Lookup for the Pelias Geocoder
https://pelias.io
MIT License
9 stars 24 forks source link

allow customization of the search paths for postal cities TSV data #296

Closed missinglink closed 4 years ago

missinglink commented 4 years ago

this feature was requested by a client who would like an easier way of editing the postal cities mapping files. prior to this PR the files are difficult to modify because they exist within a node_modules path within each of the importers.

this PR allows the user to specify a search path in pelias.json as such:

imports.adminLookup.postalCitiesDataPath = "/data/postal_cities"

this path is searched before the bundled data for both ${cc}.tsv and ${cc}.override.tsv files, if they are present within this directory then they will be used and the bundled files will be ignored. Else the bundled files are used.

no merging of files is performed. creating an empty file in your search path is equivalent to deleting the corresponding bundled file within the module.

I would strongly recommend using absolute paths to avoid any error.

Setting logger.level = "debug" will print the paths of each file as it's loaded so you can ensure they are being loaded as expected.

missinglink commented 4 years ago

Will add a brief documentation block to the readme.