diff --git a/api/obs/api/db.py b/api/obs/api/db.py index 0e025ca..82a1931 100644 --- a/api/obs/api/db.py +++ b/api/obs/api/db.py @@ -127,8 +127,8 @@ class Road(Base): zone = Column(ZoneType) name = Column(String) geometry = Column(Geometry) - tags = Column(HSTORE) directionality = Column(Integer) + oneway = Column(Boolean) NOW = text("NOW()") diff --git a/api/scripts b/api/scripts index 94e183d..8e9395f 160000 --- a/api/scripts +++ b/api/scripts @@ -1 +1 @@ -Subproject commit 94e183d7024742fcedc2c79985f0ec42f90ccc69 +Subproject commit 8e9395fd3cd0f1e83b4413546bc2d3cb0c726738 diff --git a/roads_import.lua b/roads_import.lua index 6d37f07..d024392 100644 --- a/roads_import.lua +++ b/roads_import.lua @@ -58,7 +58,7 @@ local roads = osm2pgsql.define_way_table('road', { { column = 'directionality', type = 'int' }, { column = 'name', type = 'text' }, { column = 'geometry', type = 'linestring' }, - { column = 'tags', type = 'hstore' }, + { column = 'oneway', type = 'bool' }, }) function osm2pgsql.process_way(object) @@ -92,11 +92,15 @@ function osm2pgsql.process_way(object) end local directionality = 0 + local oneway = tags.oneway + -- 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 directionality = 1 + oneway = true elseif contains(ONEWAY_REVERSE, tags.oneway) then directionality = -1 + oneway = true end roads:add_row({ @@ -104,7 +108,7 @@ function osm2pgsql.process_way(object) name = tags.name, zone = zone, directionality = directionality, - tags = tags, + oneway = oneway, }) end end