Ignore inaccessible roads, certain service roads, and areas (fixes #116)
This commit is contained in:
parent
73c1a62f80
commit
9d97489ac9
|
@ -56,6 +56,12 @@ local ADMIN_LEVEL_MAX = 8
|
||||||
local ONEWAY_YES = {"yes", "true", "1"}
|
local ONEWAY_YES = {"yes", "true", "1"}
|
||||||
local ONEWAY_REVERSE = {"reverse", "-1"}
|
local ONEWAY_REVERSE = {"reverse", "-1"}
|
||||||
|
|
||||||
|
-- https://wiki.openstreetmap.org/wiki/Tag:highway=service
|
||||||
|
local IGNORED_SERVICE_TYPES = {"parking_aisle", "driveway", "emergency_access", "drive-through"}
|
||||||
|
|
||||||
|
-- https://taginfo.openstreetmap.org/keys/access#values
|
||||||
|
local IGNORED_ACCESS_TYPES = {"no", "private", "permit", "official", "service", "emergency"}
|
||||||
|
|
||||||
local roads = osm2pgsql.define_way_table('road', {
|
local roads = osm2pgsql.define_way_table('road', {
|
||||||
{ column = 'zone', type = 'text', sql_type="zone_type" },
|
{ column = 'zone', type = 'text', sql_type="zone_type" },
|
||||||
{ column = 'directionality', type = 'int' },
|
{ column = 'directionality', type = 'int' },
|
||||||
|
@ -73,8 +79,21 @@ local regions = osm2pgsql.define_relation_table('region', {
|
||||||
|
|
||||||
|
|
||||||
function osm2pgsql.process_way(object)
|
function osm2pgsql.process_way(object)
|
||||||
if object.tags.highway and contains(HIGHWAY_TYPES, object.tags.highway) then
|
|
||||||
local tags = object.tags
|
local tags = object.tags
|
||||||
|
|
||||||
|
-- only import certain highway ways, i.e. roads and pathways
|
||||||
|
if not tags.highway then return end
|
||||||
|
if not contains(HIGHWAY_TYPES, tags.highway) then return end
|
||||||
|
|
||||||
|
-- do not import areas (plazas etc.)
|
||||||
|
if tags.area == "yes" then return end
|
||||||
|
|
||||||
|
-- ignore certain service roads
|
||||||
|
if contains(IGNORED_SERVICE_TYPES, tags.service) then return end
|
||||||
|
|
||||||
|
-- ignore disallowed roads (often tram tracks and similar)
|
||||||
|
if contains(IGNORED_ACCESS_TYPES, tags.access) then return end
|
||||||
|
|
||||||
local zone = nil
|
local zone = nil
|
||||||
|
|
||||||
if tags["zone:traffic"] then
|
if tags["zone:traffic"] then
|
||||||
|
@ -121,7 +140,6 @@ function osm2pgsql.process_way(object)
|
||||||
directionality = directionality,
|
directionality = directionality,
|
||||||
oneway = oneway,
|
oneway = oneway,
|
||||||
})
|
})
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function osm2pgsql.process_relation(object)
|
function osm2pgsql.process_relation(object)
|
||||||
|
|
Loading…
Reference in a new issue