Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
extract presence data into separate table
Browse files Browse the repository at this point in the history
  • Loading branch information
rush42 committed Jul 15, 2024
1 parent 92fa48e commit 237cb69
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion processing/topics/roads_bikelanes/roads_bikelanes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,23 @@ local bikelanesTable = osm2pgsql.define_table({
}
})

local bikelanesPresenceTable = osm2pgsql.define_table({
name = 'bikelanesPresence',
-- Note: We populate a custom `osm_id` (with unique ID values) below.
ids = { type = 'any', id_column = 'osm_id', type_column = 'osm_type' },
columns = {
{ column = 'id', type = 'text', not_null = true },
{ column = 'tags', type = 'jsonb' },
{ column = 'meta', type = 'jsonb' },
{ column = 'geom', type = 'linestring' },
{ column = 'minzoom', type = 'integer' },
},
indexes = {
{ column = { 'minzoom', 'geom' }, method = 'gist' },
{ column = 'id', method = 'btree', unique = true }
}
})

function osm2pgsql.process_way(object)
local tags = object.tags

Expand Down Expand Up @@ -136,10 +153,24 @@ function osm2pgsql.process_way(object)
end
end

local presence = BikelanesPresence(object, cycleways)
if presence ~= nil and
(presence.bikelane_left ~= "not_expected"
or presence.bikelane_right ~= "not_expected"
or presence.bikelane_self ~= "not_expected")then
bikelanesPresenceTable:insert({
tags = presence,
meta = Metadata(object),
geom = object:as_linestring(),
minzoom = 0,
id = DefaultId(object)
})
end

if not (PathClasses[tags.highway] or tags.highway == 'pedestrian') then
MergeTable(results, Maxspeed(object))
end
MergeTable(results, BikelanesPresence(object, cycleways))
MergeTable(results, presence)
results.todos = CreateTodoList(RoadTodos, tags, results)

-- We need sidewalk for Biklanes(), but not for `roads`
Expand Down

0 comments on commit 237cb69

Please sign in to comment.