diff --git a/.travis.yml b/.travis.yml index 97f13cdd..c21386bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,18 +3,14 @@ language: node_js notifications: email: false node_js: - - 4 - 6 + - 8 matrix: fast_finish: true -env: - global: - - BUILD_LEADER_ID=2 script: npm run travis before_install: - - npm i -g npm@^3.0.0 + - npm i -g npm before_script: - npm prune after_success: - - npm install -g npx - - npx -p node@8 npm run semantic-release + - npm run semantic-release diff --git a/package.json b/package.json index 7ddf38a1..60feaee7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,11 @@ { "name": "pelias-openstreetmap", "version": "0.0.0-semantic-release", + "engines": { + "node": ">=6.11.4", + "npm": ">=1.4.3", + "elasticsearch": ">=1.3.4" + }, "author": "mapzen", "description": "Pelias openstreetmap utilities", "homepage": "https://github.com/mapzen/pelias-openstreetmap", @@ -33,11 +38,6 @@ "bugs": { "url": "https://github.com/mapzen/pelias-openstreetmap/issues" }, - "engines": { - "node": ">=4.0.0", - "npm": ">=1.4.3", - "elasticsearch": ">=1.3.4" - }, "dependencies": { "async": "^2.0.0", "combined-stream": "^1.0.5", diff --git a/stream/tag_mapper.js b/stream/tag_mapper.js index 18f6bc08..c600c877 100644 --- a/stream/tag_mapper.js +++ b/stream/tag_mapper.js @@ -60,6 +60,18 @@ module.exports = function(){ } } } + + // Import airport codes as aliases + if( tags.hasOwnProperty('aerodrome') || tags.hasOwnProperty('aeroway') ){ + if( tags.hasOwnProperty('iata') ){ + var iata = trim( tags.iata ); + if( iata ){ + doc.setNameAlias( 'default', iata ); + doc.setNameAlias( 'default', `${iata} Airport` ); + doc.setPopularity(10000); + } + } + } } catch( e ){ diff --git a/test/stream/tag_mapper.js b/test/stream/tag_mapper.js index 4b28d004..5dcbe613 100644 --- a/test/stream/tag_mapper.js +++ b/test/stream/tag_mapper.js @@ -141,6 +141,22 @@ module.exports.tests.lowercase_keys = function(test, common) { }); }; +module.exports.tests.airport_codes = function(test, common) { + var doc = new Document('a','b',1); + doc.setMeta('tags', { 'name': 'test', 'aerodrome': '', 'iata': 'FOO' }); + test('alias - airport codes', function(t) { + var stream = mapper(); + stream.pipe( through.obj( function( doc, enc, next ){ + t.equal(doc.getName('default'), 'test', 'correctly mapped'); + t.deepEqual(doc.getNameAliases('default'), ['FOO', 'FOO Airport'], 'correctly mapped'); + t.deepEqual(doc.getPopularity(), 10000); + t.end(); // test will fail if not called (or called twice). + next(); + })); + stream.write(doc); + }); +}; + // ======================== addresses ========================= module.exports.tests.osm_schema = function(test, common) {