From 225a238e771c275ed442e4e76065886be9efd086 Mon Sep 17 00:00:00 2001 From: gluap Date: Fri, 24 Jun 2022 18:51:52 +0200 Subject: [PATCH] more lua ifery to detect rural streets --- roads_import.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roads_import.lua b/roads_import.lua index 4d7ab92..2c1c45b 100644 --- a/roads_import.lua +++ b/roads_import.lua @@ -61,6 +61,8 @@ local roads = osm2pgsql.define_way_table('road', { { column = 'oneway', type = 'bool' }, }) +local minspeed_rural = 60 + function osm2pgsql.process_way(object) if object.tags.highway and contains(HIGHWAY_TYPES, object.tags.highway) then local tags = object.tags @@ -92,7 +94,11 @@ function osm2pgsql.process_way(object) zone = "urban" elseif contains(MOTORWAY_TYPES, tags.highway) then zone = "motorway" - elseif (tags.maxspeed) and (tonumber(string.match(tags.maxspeed, '[%d]*'))) and tonumber(string.match(tags.maxspeed, '[%d]*')) > 60 then + elseif (tags.maxspeed) and (tonumber(string.match(tags.maxspeed, '[%d]*'))) and tonumber(string.match(tags.maxspeed, '[%d]*')) > minspeed_rural then + zone = "rural" + elseif (tags["maxspeed:forward"]) and (tonumber(string.match(tags["maxspeed:forward"], '[%d]*'))) and tonumber(string.match(tags["maxspeed:forward"], '[%d]*')) > minspeed_rural then + zone = "rural" + elseif (tags["maxspeed:backward"]) and (tonumber(string.match(tags["maxspeed:backward"], '[%d]*'))) and tonumber(string.match(tags["maxspeed:backward"], '[%d]*')) > minspeed_rural then zone = "rural" elseif tags['source:maxspeed'] and string.match(tags['source:maxspeed'], "rural") then zone = "rural"