Skip to content

Commit

Permalink
convert import styles to themepark
Browse files Browse the repository at this point in the history
Introduces presets which avoid much of the previous configuration
duplication. The original import files are now thin wrappers around
the themepark themes.
  • Loading branch information
lonvia committed Dec 6, 2024
1 parent b3894d0 commit 877a18d
Show file tree
Hide file tree
Showing 13 changed files with 439 additions and 453 deletions.
4 changes: 4 additions & 0 deletions lib-lua/flex-base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ local flex = require('themes/nominatim/init')
function flex.load_topic(name, cfg)
local topic_file = debug.getinfo(1, "S").source:sub(2):match("(.*/)") .. 'themes/nominatim/topics/'.. name .. '.lua'

if topic_file == nil then
error('Cannot find topic: ' .. name)
end

loadfile(topic_file)(nil, flex, cfg or {})
end

Expand Down
72 changes: 2 additions & 70 deletions lib-lua/import-address.lua
Original file line number Diff line number Diff line change
@@ -1,74 +1,6 @@
-- This is just an alias for the Nominatim themepark address topic
local flex = require('flex-base')

flex.set_main_tags{
highway = {motorway = 'always',
trunk = 'always',
primary = 'always',
secondary = 'always',
tertiary = 'always',
unclassified = 'always',
residential = 'always',
road = 'always',
living_street = 'always',
pedestrian = 'always',
service = 'named',
cycleway = 'named',
path = 'named',
footway = 'named',
steps = 'named',
bridleway = 'named',
track = 'named',
motorway_link = 'named',
trunk_link = 'named',
primary_link = 'named',
secondary_link = 'named',
tertiary_link = 'named'},
boundary = {administrative = 'named',
postal_code = 'always'},
landuse = 'fallback',
place = 'always'
}

flex.set_prefilters{delete_keys = {'building', 'source',
'source', '*source', 'type',
'is_in:postcode', '*:wikidata', '*:wikipedia',
'*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
'name:etymology', 'name:signed', 'name:botanical',
'addr:street:name', 'addr:street:type'},
delete_tags = {landuse = {'cemetry', 'no'},
boundary = {'place'}},
extra_keys = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital', 'area'}
}

flex.set_name_tags{main = {'name', 'name:*',
'int_name', 'int_name:*',
'nat_name', 'nat_name:*',
'reg_name', 'reg_name:*',
'loc_name', 'loc_name:*',
'old_name', 'old_name:*',
'alt_name', 'alt_name:*', 'alt_name_*',
'official_name', 'official_name:*',
'place_name', 'place_name:*',
'short_name', 'short_name:*'},
extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
'loc_ref', 'old_ref',
'iata', 'icao', 'pcode', 'pcode:*', 'ISO3166-2'},
house = {'addr:housename'}
}

flex.set_address_tags{main = {'addr:housenumber',
'addr:conscriptionnumber',
'addr:streetnumber'},
extra = {'addr:*', 'is_in:*', 'tiger:county'},
postcode = {'postal_code', 'postcode', 'addr:postcode',
'tiger:zip_left', 'tiger:zip_right'},
country = {'country_code', 'ISO3166-1',
'addr:country_code', 'is_in:country_code',
'addr:country', 'is_in:country'},
interpolation = {'addr:interpolation'}
}


flex.set_unused_handling{extra_keys = {'place'}}
flex.load_topic('address')

return flex
70 changes: 2 additions & 68 deletions lib-lua/import-admin.lua
Original file line number Diff line number Diff line change
@@ -1,72 +1,6 @@
-- This is just an alias for the Nominatim themepark admin topic
local flex = require('flex-base')

flex.set_main_tags{
boundary = {administrative = 'named'},
landuse = {residential = 'fallback',
farm = 'fallback',
farmyard = 'fallback',
industrial = 'fallback',
commercial = 'fallback',
allotments = 'fallback',
retail = 'fallback'},
place = {county = 'always',
district = 'always',
municipality = 'always',
city = 'always',
town = 'always',
borough = 'always',
village = 'always',
suburb = 'always',
hamlet = 'always',
croft = 'always',
subdivision = 'always',
allotments = 'always',
neighbourhood = 'always',
quarter = 'always',
isolated_dwelling = 'always',
farm = 'always',
city_block = 'always',
mountain_pass = 'always',
square = 'always',
locality = 'always'}
}

flex.set_prefilters{delete_keys = {'building', 'source', 'highway',
'addr:housenumber', 'addr:street', 'addr:city',
'addr:interpolation',
'source', '*source', 'type',
'is_in:postcode', '*:wikidata', '*:wikipedia',
'*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
'name:etymology', 'name:signed', 'name:botanical',
'addr:street:name', 'addr:street:type'},
delete_tags = {landuse = {'cemetry', 'no'},
boundary = {'place'}},
extra_keys = {'wikipedia', 'wikipedia:*', 'wikidata', 'capital'}
}

flex.set_name_tags{main = {'name', 'name:*',
'int_name', 'int_name:*',
'nat_name', 'nat_name:*',
'reg_name', 'reg_name:*',
'loc_name', 'loc_name:*',
'old_name', 'old_name:*',
'alt_name', 'alt_name:*', 'alt_name_*',
'official_name', 'official_name:*',
'place_name', 'place_name:*',
'short_name', 'short_name:*'},
extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
'loc_ref', 'old_ref',
'iata', 'icao', 'pcode', 'pcode:*', 'ISO3166-2'}
}

flex.set_address_tags{extra = {'addr:*', 'is_in:*'},
postcode = {'postal_code', 'postcode', 'addr:postcode'},
country = {'country_code', 'ISO3166-1',
'addr:country_code', 'is_in:country_code',
'addr:country', 'is_in:country'},
postcode_fallback = false
}

flex.set_unused_handling{extra_keys = {'place'}}
flex.load_topic('admin')

return flex
124 changes: 2 additions & 122 deletions lib-lua/import-extratags.lua
Original file line number Diff line number Diff line change
@@ -1,126 +1,6 @@
-- This is just an alias for the Nominatim themepark full topic
local flex = require('flex-base')

flex.set_main_tags{
building = 'fallback',
emergency = 'always',
healthcare = 'fallback',
historic = 'always',
military = 'always',
natural = 'named',
highway = {'always',
street_lamp = 'named',
traffic_signals = 'named',
service = 'named',
cycleway = 'named',
path = 'named',
footway = 'named',
steps = 'named',
bridleway = 'named',
track = 'named',
motorway_link = 'named',
trunk_link = 'named',
primary_link = 'named',
secondary_link = 'named',
tertiary_link = 'named'},
railway = 'named',
man_made = {'none',
pier = 'always',
tower = 'always',
bridge = 'always',
works = 'named',
water_tower = 'always',
dyke = 'named',
adit = 'named',
lighthouse = 'always',
watermill = 'always',
tunnel = 'always'},
aerialway = 'always',
boundary = {'named',
postal_code = 'always'},
aeroway = 'always',
amenity = 'always',
club = 'always',
craft = 'always',
junction = 'fallback',
landuse = 'fallback',
leisure = {'always',
nature_reserve = 'fallback'},
office = 'always',
mountain_pass = 'always',
shop = 'always',
tourism = 'always',
bridge = 'named_with_key',
tunnel = 'named_with_key',
waterway = 'named',
place = 'always'
}

flex.set_prefilters{delete_keys = {'note', 'note:*', 'source', '*source', 'attribution',
'comment', 'fixme', 'FIXME', 'created_by', 'NHD:*',
'nhd:*', 'gnis:*', 'geobase:*', 'KSJ2:*', 'yh:*',
'osak:*', 'naptan:*', 'CLC:*', 'import', 'it:fvg:*',
'type', 'lacounty:*', 'ref:ruian:*', 'building:ruian:type',
'ref:linz:*', 'is_in:postcode'},
delete_tags = {emergency = {'yes', 'no', 'fire_hydrant'},
historic = {'yes', 'no'},
military = {'yes', 'no'},
natural = {'yes', 'no', 'coastline'},
highway = {'no', 'turning_circle', 'mini_roundabout',
'noexit', 'crossing', 'give_way', 'stop'},
railway = {'level_crossing', 'no', 'rail', 'switch',
'abandoned', 'signal', 'buffer_stop', 'razed'},
aerialway = {'pylon', 'no'},
aeroway = {'no'},
amenity = {'no', 'parking_space', 'parking_entrance',
'waste_disposal', 'hunting_stand'},
club = {'no'},
craft = {'no'},
leisure = {'no'},
office = {'no'},
mountain_pass = {'no'},
shop = {'no'},
tourism = {'yes', 'no'},
bridge = {'no'},
tunnel = {'no'},
waterway = {'riverbank'},
building = {'no'},
boundary = {'place', 'land_area'}},
extra_keys = {'*:prefix', '*:suffix', 'name:prefix:*', 'name:suffix:*',
'name:etymology', 'name:signed', 'name:botanical',
'wikidata', '*:wikidata',
'*:wikipedia', 'brand:wikipedia:*',
'addr:street:name', 'addr:street:type'}
}

flex.set_name_tags{main = {'name', 'name:*',
'int_name', 'int_name:*',
'nat_name', 'nat_name:*',
'reg_name', 'reg_name:*',
'loc_name', 'loc_name:*',
'old_name', 'old_name:*',
'alt_name', 'alt_name:*', 'alt_name_*',
'official_name', 'official_name:*',
'place_name', 'place_name:*',
'short_name', 'short_name:*', 'brand'},
extra = {'ref', 'int_ref', 'nat_ref', 'reg_ref',
'loc_ref', 'old_ref',
'iata', 'icao', 'pcode', 'pcode:*', 'ISO3166-2'},
house = {'addr:housename'}
}

flex.set_address_tags{main = {'addr:housenumber',
'addr:conscriptionnumber',
'addr:streetnumber'},
extra = {'addr:*', 'is_in:*', 'tiger:county'},
postcode = {'postal_code', 'postcode', 'addr:postcode',
'tiger:zip_left', 'tiger:zip_right'},
country = {'country_code', 'ISO3166-1',
'addr:country_code', 'is_in:country_code',
'addr:country', 'is_in:country'},
interpolation = {'addr:interpolation'}
}


flex.set_unused_handling{delete_keys = {'tiger:*'}}
flex.load_topic('full', {with_extratags = true})

return flex
Loading

0 comments on commit 877a18d

Please sign in to comment.