Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable more tags to trigger construction warnings #2313

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions plugins/Construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def init(self, logger):
been in construction for more than two years or opening data is
exceeded.'''))

self.tag_construction = ["highway", "landuse", "building"]
# Tags where the value "construction" does not refer to construction work on the object itself
# Note that only company=construction is documented
self.tag_not_construction = ["company", "craft", "historic", "industrial", "shop"]

self.tag_date = ["opening_date", "open_date", "construction:date", "temporary:date_on", "date_on"]
self.default_date = datetime.datetime(9999, 12, 1)
self.today = datetime.datetime.today()
Expand All @@ -65,15 +68,14 @@ def convert2date(self, string):
pass

def node(self, data, tags):
construction_found = False
for t in tags:
if t == "construction" or (t.startswith("construction:") and t != "construction:date"):
construction_found = True
break
construction_found = "construction" in tags

if not construction_found and "operational_status" in tags:
construction_found = tags.get("operational_status").endswith("construction")
if not construction_found:
for t in self.tag_construction:
if tags.get(t) == "construction":
for t in tags:
if ((t.startswith("construction:") and t != "construction:date")
or (tags.get(t) == "construction" and t not in self.tag_not_construction and ":" not in t)):
construction_found = True
break

Expand All @@ -95,7 +97,7 @@ def node(self, data, tags):

delta = int(self.total_seconds(self.today - end_date))
if delta > 0:
# Change the subclass every 6 months after expiration, re-popup the marker in frontend event if set as false-positive
# Change the subclass every 6 months after expiration, re-popup the marker in frontend even if set as false-positive
return {"class": 4070, "subclass": delta // self.recall}

def way(self, data, tags, nds):
Expand Down Expand Up @@ -124,11 +126,16 @@ def test(self):
{"highway": "construction"},
{"landuse": "construction"},
{"building": "construction"},
{"operational_status": "under_construction"},
{"railway": "construction"},
{"construction:man_made": "water_works"},
]
other_tags = [{"highway": "primary"},
{"landuse": "farm"},
{"building": "yes"},
{"company": "construction"},
{"construction:date": "2001-01-01"},
{"removed:landuse": "construction"},
]

correct_dates = ["2010-02-03",
Expand Down
Loading