+-- Customized main tag filter functions
+
+local EXCLUDED_FOOTWAYS = { sidewalk = 1, crossing = 1, link = 1, traffic_aisle }
+
+local function filter_footways(place)
+ if place.has_name then
+ local footway = place.object.tags.footway
+ if footway == nil or EXCLUDED_FOOTWAYS[footway] ~= 1 then
+ return place
+ end
+ end
+ return false
+end
+
+local function include_when_tag_present(key, value, named)
+ if named then
+ return function(place)
+ if place.has_name and place.intags[key] == value then
+ return place
+ end
+ return false
+ end
+ else
+ return function(place)
+ if place.intags[key] == value then
+ return place
+ end
+ return false
+ end
+ end
+end
+
+local function exclude_when_key_present(key, named)
+ if named then
+ return function(place)
+ if place.has_name and place.intags[key] == nil then
+ return place
+ end
+ return false
+ end
+ else
+ return function(place)
+ if place.intags[key] == nil then
+ return place
+ end
+ return false
+ end
+
+ end
+end
+