Skip to content

Commit

Permalink
dedupe places
Browse files Browse the repository at this point in the history
Hacky workaround to deal with OSM data issues, fixes #1
  • Loading branch information
cldellow committed Jan 13, 2024
1 parent c9a814f commit 241e6bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions slices/places.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ node_keys = {'place'}
way_keys = node_keys

qrank = nil
keydb = nil

function init_function()
qrank = require 'qrank'
qrank.init()

keydb = require 'keydb'
keydb.init()
end

function exit_function()
Expand Down Expand Up @@ -61,6 +65,7 @@ function maybe_emit(is_area)
if mz_place == nil or mz_place < 0 then return end

local wikidata = Find('wikidata')
local wikidata_safe = string.match(wikidata, "^Q%d+$")
local rank = qrank.get(wikidata)


Expand Down Expand Up @@ -92,8 +97,10 @@ function maybe_emit(is_area)
mz = 10
end
if is_area then
if wikidata_safe and keydb.test(wikidata_safe) then return end
LayerAsCentroid('place_name', 'polylabel', 'label')
else
if wikidata_safe then keydb.set(wikidata_safe) end
Layer('place_name')
end

Expand Down

0 comments on commit 241e6bc

Please sign in to comment.