revert importing of housenumber interpolations

This commit is contained in:
Sarah Hoffmann
2026-02-18 20:01:15 +01:00
parent b71543b03b
commit abd5cbada6
15 changed files with 242 additions and 344 deletions

View File

@@ -79,12 +79,12 @@ local table_definitions = {
}
},
place_interpolation = {
ids = { type = 'any', id_column = 'osm_id', type_column = 'osm_type' },
ids = { type = 'way', id_column = 'osm_id' },
columns = {
{ column = 'type', type = 'text', not_null = true },
{ column = 'address', type = 'hstore' },
{ column = 'nodes', type = 'text', sql_type = 'bigint[]' },
{ column = 'geometry', type = 'geometry', projection = 'WGS84', not_null = true },
{ column = 'nodes', type = 'text', sql_type = 'bigint[]', not_null = true },
{ column = 'geometry', type = 'linestring', projection = 'WGS84', not_null = true },
},
indexes = {
{ column = 'nodes', method = 'gin' }
@@ -387,6 +387,7 @@ function Place:grab_address_parts(data)
if atype ~= nil then
if atype == 'main' then
self.has_name = true
self.address[strip_address_prefix(k)] = v
count = count + 1
elseif atype == 'extra' then
@@ -707,38 +708,31 @@ function module.process_tags(o)
local fallback = o:grab_name_parts{groups=NAME_FILTER}
-- address keys
local fallback_address = (o:grab_address_parts{groups=ADDRESS_FILTER} > 0)
if o:grab_address_parts{groups=ADDRESS_FILTER} > 0 and fallback == nil then
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.interpolation ~= nil
and (o.address.housenumber == nil
or string.find(o.address.housenumber, '^%d+%-%d+$') ~= nil) then
if o:geometry_is_valid() then
local extra_addr = nil
for k, v in pairs(o.address) do
if k ~= 'interpolation' then
if extra_addr == nil then
extra_addr = {}
end
extra_addr[k] = v
if o.address.interpolation ~= nil and o.address.housenumber == nil
and o.object.type == 'way' and o.object.nodes ~= nil then
local extra_addr = nil
for k, v in pairs(o.address) do
if k ~= 'interpolation' then
if extra_addr == nil then
extra_addr = {}
end
extra_addr[k] = v
end
local nodes = nil
if o.address.housenumber == nil and o.object.nodes ~= nil then
nodes = '{' .. table.concat(o.object.nodes, ',') .. '}'
end
insert_row.place_interpolation{
type = o.address.interpolation,
address = extra_addr,
nodes = nodes,
geometry = o.geometry
}
fallback_address = false
else
return
end
insert_row.place_interpolation{
type = o.address.interpolation,
address = extra_addr,
nodes = '{' .. table.concat(o.object.nodes, ',') .. '}',
geometry = o.object:as_linestring()
}
end
-- collect main keys
@@ -760,7 +754,7 @@ function module.process_tags(o)
geometry = o.geometry
}
end
elseif ktype == 'fallback' and (fallback_address or o.has_name) then
elseif ktype == 'fallback' and o.has_name then
fallback = {k, v, PlaceTransform.always}
end
end
@@ -769,8 +763,6 @@ function module.process_tags(o)
if o.num_entries == 0 then
if fallback ~= nil then
o:write_place(fallback[1], fallback[2], fallback[3])
elseif fallback_address then
o:write_place('place', 'house', address_fallback)
elseif POSTCODE_FALLBACK and not postcode_collect
and o.address.postcode ~= nil
and o:geometry_is_valid() then