Skip to content

Commit

Permalink
feat(addendum): additional addendum fields (#529)
Browse files Browse the repository at this point in the history
* refactor(features): use modern JS

* feat(addendum): add website, phone, operating_hours

* feat(addendum): add selected tags to addendum
  • Loading branch information
missinglink authored May 8, 2020
1 parent 967c5d5 commit b4e0942
Show file tree
Hide file tree
Showing 5 changed files with 5,359 additions and 1,514 deletions.
4 changes: 2 additions & 2 deletions config/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
**/

// default tags imported
var tags = [
const tags = [
'addr:housenumber+addr:street'
];

// tags corresponding to venues
var venue_tags = [
const venue_tags = [
'amenity+name',
'building+name',
'shop+name',
Expand Down
6 changes: 3 additions & 3 deletions stream/addendum_mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const whitelist = [
'wikipedia', // Wikipedia concordance
'operator', // Operator name
'brand', // Brand name
// 'website', // Website URL
// 'phone', // Telephone number
// 'opening_hours', // Opening hours
'website', // Website URL
'phone', // Telephone number
'opening_hours', // Opening hours
];

module.exports = function(){
Expand Down
85 changes: 42 additions & 43 deletions test/config/features.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

var features = require('../../config/features');
const features = require('../../config/features');

module.exports.tests = {};

Expand All @@ -15,10 +14,10 @@ module.exports.tests.interface = function(test, common) {
module.exports.tests.blacklist = function(test, common) {
test('blacklist default tags', function(t) {
// see: https://github.com/pelias/openstreetmap/pull/280
t.true( features.tags.indexOf('aeroway+name') <0 );
t.true( features.tags.indexOf('aeroway~gate+name') <0 );
t.true( features.tags.indexOf('railway+name') <0 );
t.true( features.tags.indexOf('railway~rail+name') <0 );
t.false( features.tags.includes('aeroway+name') );
t.false( features.tags.includes('aeroway~gate+name') );
t.false( features.tags.includes('railway+name') );
t.false( features.tags.includes('railway~rail+name') );
t.end();
});
};
Expand All @@ -27,49 +26,49 @@ module.exports.tests.blacklist = function(test, common) {
// we exclude by default tags corresponding to venues
module.exports.tests.whitelist = function(test, common) {
test('whitelist default tags', function(t) {
t.false( features.tags.indexOf('addr:housenumber+addr:street') <0 );
t.true( features.venue_tags.indexOf('amenity+name') <0 );
t.true( features.tags.includes('addr:housenumber+addr:street') );
t.false( features.tags.includes('amenity+name') );
t.end();
});
};

// ensure some venue tags are included
module.exports.tests.whitelist = function(test, common) {
module.exports.tests.whitelist_venue_tags = function(test, common) {
test('whitelist venue tags', function(t) {
t.false( features.venue_tags.indexOf('amenity+name') <0 );
t.false( features.venue_tags.indexOf('building+name') <0 );
t.false( features.venue_tags.indexOf('shop+name') <0 );
t.false( features.venue_tags.indexOf('office+name') <0 );
t.false( features.venue_tags.indexOf('public_transport+name') <0 );
t.false( features.venue_tags.indexOf('cuisine+name') <0 );
t.false( features.venue_tags.indexOf('railway~tram_stop+name') <0 );
t.false( features.venue_tags.indexOf('railway~station+name') <0 );
t.false( features.venue_tags.indexOf('railway~halt+name') <0 );
t.false( features.venue_tags.indexOf('railway~subway_entrance+name') <0 );
t.false( features.venue_tags.indexOf('railway~train_station_entrance+name') <0 );
t.false( features.venue_tags.indexOf('sport+name') <0 );
t.false( features.venue_tags.indexOf('natural+name') <0 );
t.false( features.venue_tags.indexOf('tourism+name') <0 );
t.false( features.venue_tags.indexOf('leisure+name') <0 );
t.false( features.venue_tags.indexOf('historic+name') <0 );
t.false( features.venue_tags.indexOf('man_made+name') <0 );
t.false( features.venue_tags.indexOf('landuse+name') <0 );
t.false( features.venue_tags.indexOf('waterway+name') <0 );
t.false( features.venue_tags.indexOf('aerialway+name') <0 );
t.false( features.venue_tags.indexOf('craft+name') <0 );
t.false( features.venue_tags.indexOf('military+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~terminal+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~aerodrome+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~helipad+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~airstrip+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~heliport+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~areodrome+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~spaceport+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~landing_strip+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~airfield+name') <0 );
t.false( features.venue_tags.indexOf('aeroway~airport+name') <0 );
t.false( features.venue_tags.indexOf('brand+name') <0 );
t.false( features.venue_tags.indexOf('healthcare+name') <0 );
t.true( features.venue_tags.includes('amenity+name') );
t.true( features.venue_tags.includes('building+name') );
t.true( features.venue_tags.includes('shop+name') );
t.true( features.venue_tags.includes('office+name') );
t.true( features.venue_tags.includes('public_transport+name') );
t.true( features.venue_tags.includes('cuisine+name') );
t.true( features.venue_tags.includes('railway~tram_stop+name') );
t.true( features.venue_tags.includes('railway~station+name') );
t.true( features.venue_tags.includes('railway~halt+name') );
t.true( features.venue_tags.includes('railway~subway_entrance+name') );
t.true( features.venue_tags.includes('railway~train_station_entrance+name') );
t.true( features.venue_tags.includes('sport+name') );
t.true( features.venue_tags.includes('natural+name') );
t.true( features.venue_tags.includes('tourism+name') );
t.true( features.venue_tags.includes('leisure+name') );
t.true( features.venue_tags.includes('historic+name') );
t.true( features.venue_tags.includes('man_made+name') );
t.true( features.venue_tags.includes('landuse+name') );
t.true( features.venue_tags.includes('waterway+name') );
t.true( features.venue_tags.includes('aerialway+name') );
t.true( features.venue_tags.includes('craft+name') );
t.true( features.venue_tags.includes('military+name') );
t.true( features.venue_tags.includes('aeroway~terminal+name') );
t.true( features.venue_tags.includes('aeroway~aerodrome+name') );
t.true( features.venue_tags.includes('aeroway~helipad+name') );
t.true( features.venue_tags.includes('aeroway~airstrip+name') );
t.true( features.venue_tags.includes('aeroway~heliport+name') );
t.true( features.venue_tags.includes('aeroway~areodrome+name') );
t.true( features.venue_tags.includes('aeroway~spaceport+name') );
t.true( features.venue_tags.includes('aeroway~landing_strip+name') );
t.true( features.venue_tags.includes('aeroway~airfield+name') );
t.true( features.venue_tags.includes('aeroway~airport+name') );
t.true( features.venue_tags.includes('brand+name') );
t.true( features.venue_tags.includes('healthcare+name') );
t.end();
});
};
Expand Down
Loading

0 comments on commit b4e0942

Please sign in to comment.