Skip to content

Commit

Permalink
include lock names mapped with "lock_name"
Browse files Browse the repository at this point in the history
  • Loading branch information
lonvia committed Dec 9, 2024
1 parent 006e0e5 commit 00542de
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib-lua/themes/nominatim/presets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ local function exclude_when_key_present(key, named)
end
end

local function lock_transform(place)
if place.object.tags.waterway ~= nil then
local name = place.object.tags.lock_name
if name ~= nil then
return place:clone{names={name=name, ref=place.object.tags.lock_ref}}
end
end

return false
end

-- Main tag definition

module.MAIN_TAGS = {}
Expand Down Expand Up @@ -169,6 +180,7 @@ module.MAIN_TAGS_POIS = function (group)
leisure = {'always',
nature_reserve = 'fallback',
no = group},
lock = {yes = lock_transform},
man_made = {pier = 'always',
tower = 'always',
bridge = 'always',
Expand Down
15 changes: 15 additions & 0 deletions test/bdd/osm2pgsql/import/tags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,18 @@ Feature: Tag evaluation
| N1:place | house | 'housenumber': '23' | - |
| N2:place | house | 'housenumber': '23' | 'addr:housename': 'Foo' |
| N3:place | house | 'housenumber': '23' | - |


Scenario: Waterway locks
When loading osm data
"""
n1 Twaterway=river,lock=yes
n2 Twaterway=river,lock=yes,lock_name=LeLock
n3 Twaterway=river,lock=yes,name=LeWater
n4 Tamenity=parking,lock=yes,lock_name=Gold
"""
Then place contains exactly
| object | type | name |
| N2:lock | yes | 'name': 'LeLock' |
| N3:waterway | river | 'name': 'LeWater' |
| N4:amenity | parking | - |

0 comments on commit 00542de

Please sign in to comment.