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

Commit

Permalink
Public transport: Rework the new category for ferry and light_rail
Browse files Browse the repository at this point in the history
  • Loading branch information
tordans committed Jan 9, 2024
1 parent be36417 commit 009e60b
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions app/process/publicTransport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ require("CopyTags")
require("MergeArray")
require("Metadata")


local table = osm2pgsql.define_table({
name = 'publicTransport',
ids = { type = 'any', id_column = 'osm_id', type_column = 'osm_type' },
Expand All @@ -16,8 +15,7 @@ local table = osm2pgsql.define_table({
})

local function ExitProcessing(object)
local isFerryStopPosition = object.tags.public_transport == "platform" and object.tags.ferry == "yes"
if not (object.tags.railway or isFerryStopPosition) then
if not (object.tags.railway or object.tags.amenity == "ferry_terminal") then
return true
end

Expand All @@ -35,29 +33,41 @@ local function ExitProcessing(object)
end

local function processTags(tags)
local isFerryStopPosition = tags.public_transport == "platform" and tags.ferry == "yes"
local category
if (isFerryStopPosition) then

-- Ferry
-- https://wiki.openstreetmap.org/wiki/DE:Tag:amenity%3Dferry_terminal
-- https://wiki.openstreetmap.org/wiki/DE:Key:ferry
if (tags.amenity == "ferry_terminal") then
category = "ferry_station"
end

-- U-Bahn
-- https://wiki.openstreetmap.org/wiki/DE:Tag:station%3Dsubway
if (tags.railway == "subway") then
category = "subway_station"
end

-- S-Bahn
-- https://wiki.openstreetmap.org/wiki/DE:Tag:railway%3Dlight_rail
if (tags.railway == "light_rail") then
category = "light_rail_station"
end

-- Straßenbahn
-- https://wiki.openstreetmap.org/wiki/DE:Tag:railway%3Dtram_stop
if (tags.railway == "tram_stop") then
category = "tram_station"
end

-- Bahn
-- https://wiki.openstreetmap.org/wiki/DE:Tag:railway%3Dstation
-- https://wiki.openstreetmap.org/wiki/DE:Tag:railway%3Dhalt
if (tags.railway == "station" or tags.railway == "halt") then
category = "railway_station"
end

-- NOTE ON BUS:
-- Bus:
-- We don't handle bus stops ATM because they are not too relevant for our use cases.
-- We might add them later…

Expand All @@ -66,21 +76,22 @@ local function processTags(tags)
category = "undefined"
end

-- these tags are getting copied
-- these tags are copied
local allowed_tags = {
"name", -- Eigenname
"operator", -- Eigenname
}
-- these tags are getting copied and prefixed with `osm_`
-- these tags are copied and prefixed with `osm_`
local tags_cc = {
"network",
"network:short",
"railway",
"station",
"light_rail",
"bus",
"ferry",
}
local result = {category = category}
local result = { category = category }
CopyTags(result, tags, tags_cc, 'osm_')
CopyTags(result, tags, allowed_tags)
return result
Expand Down

0 comments on commit 009e60b

Please sign in to comment.