Do not store all road tags in PostGIS

This commit is contained in:
Paul Bienkowski 2021-11-24 23:07:22 +01:00
parent 16903042bc
commit 8998ffa10a
3 changed files with 8 additions and 4 deletions

View file

@ -127,8 +127,8 @@ class Road(Base):
zone = Column(ZoneType) zone = Column(ZoneType)
name = Column(String) name = Column(String)
geometry = Column(Geometry) geometry = Column(Geometry)
tags = Column(HSTORE)
directionality = Column(Integer) directionality = Column(Integer)
oneway = Column(Boolean)
NOW = text("NOW()") NOW = text("NOW()")

@ -1 +1 @@
Subproject commit 94e183d7024742fcedc2c79985f0ec42f90ccc69 Subproject commit 8e9395fd3cd0f1e83b4413546bc2d3cb0c726738

View file

@ -58,7 +58,7 @@ local roads = osm2pgsql.define_way_table('road', {
{ column = 'directionality', type = 'int' }, { column = 'directionality', type = 'int' },
{ column = 'name', type = 'text' }, { column = 'name', type = 'text' },
{ column = 'geometry', type = 'linestring' }, { column = 'geometry', type = 'linestring' },
{ column = 'tags', type = 'hstore' }, { column = 'oneway', type = 'bool' },
}) })
function osm2pgsql.process_way(object) function osm2pgsql.process_way(object)
@ -92,11 +92,15 @@ function osm2pgsql.process_way(object)
end end
local directionality = 0 local directionality = 0
local oneway = tags.oneway
-- See https://wiki.openstreetmap.org/wiki/Key:oneway section "Implied oneway restriction" -- See https://wiki.openstreetmap.org/wiki/Key:oneway section "Implied oneway restriction"
if contains(ONEWAY_YES, tags.oneway) or tags.junction == "roundabout" or zone == "motorway" then if contains(ONEWAY_YES, tags.oneway) or tags.junction == "roundabout" or zone == "motorway" then
directionality = 1 directionality = 1
oneway = true
elseif contains(ONEWAY_REVERSE, tags.oneway) then elseif contains(ONEWAY_REVERSE, tags.oneway) then
directionality = -1 directionality = -1
oneway = true
end end
roads:add_row({ roads:add_row({
@ -104,7 +108,7 @@ function osm2pgsql.process_way(object)
name = tags.name, name = tags.name,
zone = zone, zone = zone,
directionality = directionality, directionality = directionality,
tags = tags, oneway = oneway,
}) })
end end
end end