summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b1e5265)
If an object doesn't have a useable main tag, then the names should
always be ignored, independently of the presence of housenumbers.
We have to assume that the name belongs to a feature that was
intentionally filtered out.
+-- Special transform used with address fallbacks: ignore all names
+-- except for those marked as being part of the address.
+local function address_fallback(place)
+ if next(place.names) == nil or NAMES.house == nil then
+ return place
+ end
+
+ local names = {}
+ for k, v in pairs(place.names) do
+ if NAME_FILTER(k, v) == 'house' then
+ names[k] = v
+ end
+ end
+ return place:clone{names=names}
+end
+
--------- Built-in extratags transformation functions ---------------
local function default_extratags_filter(p, k)
--------- Built-in extratags transformation functions ---------------
local function default_extratags_filter(p, k)
self.has_name = true
elseif atype == 'house' then
self.has_name = true
self.has_name = true
elseif atype == 'house' then
self.has_name = true
- fallback = {'place', 'house', PlaceTransform.always}
+ fallback = {'place', 'house', address_fallback}
-- address keys
if o:grab_address_parts{groups=ADDRESS_FILTER} > 0 and fallback == nil then
-- address keys
if o:grab_address_parts{groups=ADDRESS_FILTER} > 0 and fallback == nil then
- fallback = {'place', 'house', PlaceTransform.always}
+ fallback = {'place', 'house', address_fallback}
end
if o.address.country ~= nil and #o.address.country ~= 2 then
o.address['country'] = nil
end
if o.address.country ~= nil and #o.address.country ~= 2 then
o.address['country'] = nil
"stone" : 30,
"" : [22, 0]
},
"stone" : 30,
"" : [22, 0]
},
+ "water" : {
+ "lake" : [20, 0],
+ "reservoir" : [20, 0],
+ "wastewater" : [24, 0],
+ "pond" : [24, 0],
+ "fountain" : [24, 0],
+ "" : [22, 0]
+ },
"waterway" : {
"river" : [19, 0],
"stream" : [22, 0],
"waterway" : {
"river" : [19, 0],
"stream" : [22, 0],
Then exactly 1 result is returned
And results contain
| class |
Then exactly 1 result is returned
And results contain
| class |
| N21:natural | water |
| N23:water | pond |
| N26:natural | water |
| N21:natural | water |
| N23:water | pond |
| N26:natural | water |
+
+ Scenario: Drop name for address fallback
+ When loading osm data
+ """
+ n1 Taddr:housenumber=23,name=Foo
+ n2 Taddr:housenumber=23,addr:housename=Foo
+ n3 Taddr:housenumber=23
+ """
+ Then place contains exactly
+ | object | type | address | name |
+ | N1:place | house | 'housenumber': '23' | - |
+ | N2:place | house | 'housenumber': '23' | 'addr:housename': 'Foo' |
+ | N3:place | house | 'housenumber': '23' | - |