mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-26 13:27:52 +03:00
flex: add combining clean function
This commit is contained in:
parent
d9d13a6204
commit
de3c28104c
@ -44,6 +44,19 @@ function Place.new(object, geom_func)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Place:clean(data)
|
||||||
|
if data.delete ~= nil or data.extra ~= nil then
|
||||||
|
for k, v in pairs(self.object.tags) do
|
||||||
|
if data.delete ~= nil and data.delete(k, v) then
|
||||||
|
self.object.tags[k] = nil
|
||||||
|
elseif data.extra ~= nil and data.extra(k, v) then
|
||||||
|
self.extratags[k] = v
|
||||||
|
self.object.tags[k] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Place:delete(data)
|
function Place:delete(data)
|
||||||
if data.match ~= nil then
|
if data.match ~= nil then
|
||||||
for k, v in pairs(self.object.tags) do
|
for k, v in pairs(self.object.tags) do
|
||||||
@ -423,8 +436,7 @@ function osm2pgsql.process_relation(object)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function process_tags(o)
|
function process_tags(o)
|
||||||
o:delete{match = PRE_DELETE}
|
o:clean{delete = PRE_DELETE, extra = PRE_EXTRAS}
|
||||||
o:grab_extratags{match = PRE_EXTRAS}
|
|
||||||
|
|
||||||
-- Exception for boundary/place double tagging
|
-- Exception for boundary/place double tagging
|
||||||
if o.object.tags.boundary == 'administrative' then
|
if o.object.tags.boundary == 'administrative' then
|
||||||
@ -452,8 +464,7 @@ function process_tags(o)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
o:delete{match = POST_DELETE}
|
o:clean{delete = POST_DELETE, extra = POST_EXTRAS}
|
||||||
o:grab_extratags{match = POST_EXTRAS}
|
|
||||||
|
|
||||||
-- collect main keys
|
-- collect main keys
|
||||||
for k, v in pairs(o.object.tags) do
|
for k, v in pairs(o.object.tags) do
|
||||||
|
Loading…
Reference in New Issue
Block a user