Skip to content

Commit

Permalink
feat: Merge pull request #142 from pelias/configureVenueImport
Browse files Browse the repository at this point in the history
Read venue import and download settings from config
  • Loading branch information
orangejulius authored Oct 3, 2016
2 parents f4c1fee + cbf54d8 commit b0564bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion download_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ function generateCommand(type, directory) {
return 'curl https://whosonfirst.mapzen.com/bundles/wof-' + type + '-latest-bundle.tar.bz2 | tar -xj --strip-components=1 --exclude=README.txt -C ' + directory + ' && mv ' + directory + '/wof-' + type + '-latest.csv ' + directory + '/meta/';
}

var bundlesToDownload = bundles.allBundles;
var bundlesToDownload = bundles.hierarchyBundles;

if (config.imports.whosonfirst.importVenues) {
bundlesToDownload = bundlesToDownload.concat(bundles.venueBundles);
}

// this should override the config setting since the hierarchy bundles are useful
// on their own to allow other importers to start when using admin lookup
if (process.argv[2] == '--admin-only') {
bundlesToDownload = bundles.hierarchyBundles;
}
Expand Down
8 changes: 7 additions & 1 deletion import.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ if (directory.slice(-1) !== '/') {
// of other, lower admin records as well as venues
var wofAdminRecords = {};

var readStream = readStreamModule.create(directory, bundles.allBundles, wofAdminRecords);
var bundlesToImport = bundles.hierarchyBundles;

if (peliasConfig.imports.whosonfirst.importVenues) {
bundlesToImport = bundlesToImport.concat(bundles.venueBundles);
}

var readStream = readStreamModule.create(directory, bundlesToImport, wofAdminRecords);

// how to convert WOF records to Pelias Documents
var documentGenerator = peliasDocGenerators.create(
Expand Down

0 comments on commit b0564bf

Please sign in to comment.