Skip to content

Commit

Permalink
made sure that recreational nodes are added correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Nov 11, 2024
1 parent df19b31 commit 4b18f47
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions map/osm2pgsql/style.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ local clean_useless_tags = osm2pgsql.make_clean_tags_func(delete_keys)

-- Helper function to remove some of the tags we usually are not interested in.
-- Returns true if there are no tags left.
local function clean_tags(tags)
local function clean_tags_indoor(tags)
if clean_useless_tags(tags) then
return true
end
Expand Down Expand Up @@ -229,7 +229,18 @@ function osm2pgsql.process_node(object)
-- Uncomment next line to look at the object data:
-- print(inspect(object))

if clean_tags(object.tags) then
if object.tags.natural == 'tree' or object.tags.amenity == 'bench' or object.tags.amenity == 'lounger' or object.tags.leisure == 'picnic_table' then
tables.recreational_nodes:insert(
{
natural = object.tags.natural,
amenity = object.tags.amenity,
leisure = object.tags.leisure,
geom = object:as_point()
}
)
end

if clean_tags_indoor(object.tags) then
return
end
-- pois should not need layers. Using them is likely a bug
Expand All @@ -243,16 +254,6 @@ function osm2pgsql.process_node(object)
}
)
end
if object.tags.natural == 'tree' or object.tags.amenity == 'bench' or object.tags.amenity == 'lounger' or object.tags.leisure == 'picnic_table' then
tables.recreational_nodes:insert(
{
natural = object.tags.natural,
amenity = object.tags.amenity,
leisure = object.tags.leisure,
geom = object:as_point()
}
)
end
end

-- Called for every way in the input. The `object` argument contains the same
Expand All @@ -265,7 +266,7 @@ function osm2pgsql.process_way(object)
object.tags.indoor = nil
object.tags.level = nil
object.tags.inside = nil
elseif clean_tags(object.tags) then
elseif clean_tags_indoor(object.tags) then
return
end

Expand Down Expand Up @@ -299,7 +300,7 @@ function osm2pgsql.process_relation(object)
-- Uncomment next line to look at the object data:
-- print(inspect(object))

if clean_tags(object.tags) then
if clean_tags_indoor(object.tags) then
return
end

Expand Down

0 comments on commit 4b18f47

Please sign in to comment.