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

Commit

Permalink
Boundaries: Fix categories
Browse files Browse the repository at this point in the history
  • Loading branch information
tordans committed Jan 22, 2024
1 parent c365a3d commit 6d7501e
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions app/process/boundaries/boundaries.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,30 @@ function osm2pgsql.process_relation(object)
return
end

local category_municipality = nil -- Gemeinden
local category_district = nil -- Landkreise
if (tags.admin_level == 8) then
category_municipality = "Gemeinde"
local results_tags = {}
results_tags.admin_level = tonumber(tags.admin_level)
results_tags.population = tonumber(tags.population)
-- Categories:
if (results_tags.admin_level == 8) then
results_tags.category_municipality = "Gemeinde"
end
if (tags.admin_level == 6) then
category_district = "Landkreis"
if (results_tags.admin_level == 6) then
results_tags.category_district = "Landkreis"
if (tags.place == "city" or tags["name:prefix"] == "Kreisfreie Stadt") then
category_municipality = "Kreisfreie Stadt"
category_district = "Kreisfreie Stadt"
results_tags.category_municipality = "Kreisfreie Stadt"
results_tags.category_district = "Kreisfreie Stadt"
end
end
if (tags.admin_level == 4 and tags.place == "city") then
category_municipality = "Stadtstaat"
category_district = "Stadtstaat"
if (results_tags.admin_level == 4 and tags.place == "city") then
results_tags.category_municipality = "Stadtstaat"
results_tags.category_district = "Stadtstaat"
end

local results_tags = {}
-- these tags are copied (Eigennamen)
local allowed_tags = { "name", "name:prefix" }
CopyTags(results_tags, tags, allowed_tags)
-- these tags are copied and prefixed with `osm_`
local tags_cc = { "de:regionalschluessel", "population:date", "wikidata", "wikipedia" }
CopyTags(results_tags, tags, tags_cc, "osm_")
results_tags.admin_level = tonumber(tags.admin_level)
results_tags.population = tonumber(tags.population)
results_tags.category_municipality = category_municipality
results_tags.category_district = category_district

-- Make sure we only include boundaries with a geometry
-- https://osm2pgsql.org/doc/manual.html#processing-callbacks
Expand Down

0 comments on commit 6d7501e

Please sign in to comment.