Skip to content

Commit

Permalink
Remove diff mode from highway_noexit sql10
Browse files Browse the repository at this point in the history
sql10 relies on COUNT(*), but in diff mode not all joined elements are present in the `touched_*` datasets, hence the count may be lower than the true count.

This should also solve a server error with duplicate elements that only occurred in diff mode.

See #2060
  • Loading branch information
Famlam authored and frodrigo committed Nov 7, 2023
1 parent a40fc91 commit 51dc3b9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions analysers/analyser_osmosis_highway_noexit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
ST_AsText(nodes.geom),
COUNT(*) > 1
FROM
{1}highways AS ways
highways AS ways
JOIN way_nodes ON
way_nodes.way_id = ways.id
JOIN {0}nodes AS nodes ON
JOIN nodes ON
nodes.id = way_nodes.node_id AND
nodes.tags != ''::hstore AND
nodes.tags?'noexit' AND
Expand Down Expand Up @@ -82,26 +82,20 @@
class Analyser_Osmosis_Highway_Noexit(Analyser_Osmosis):

requires_tables_full = ['highways']
requires_tables_diff = ['highways', 'touched_highways', 'not_touched_highways']

def __init__(self, config, logger = None):
Analyser_Osmosis.__init__(self, config, logger)
self.classs_change[1] = self.def_class(item = 3210, level = 2, tags = ['highway', 'tag', 'fix:chair'],
self.classs[1] = self.def_class(item = 3210, level = 2, tags = ['highway', 'tag', 'fix:chair'],
title = T_('Noexit on node with exit'))
self.classs[2] = self.def_class(item = 3210, level = 2, tags = ['highway', 'tag', 'fix:chair'],
title = T_('Noexit on way with multiple exits'))
self.callback10 = lambda res: {"class":1, "subclass":1 if res[2] else 2, "data":[self.node_full, self.positionAsText], "fix":{"-":["noexit"]}}
self.callback20 = lambda res: {"class":2, "data":[self.way_full, self.positionAsText], "fix":{"-":["noexit"]} }

def analyser_osmosis_common(self):
self.run(sql10, self.callback10)
self.run(sql20, self.callback20)

def analyser_osmosis_full(self):
self.run(sql10.format("", ""), self.callback10)

def analyser_osmosis_diff(self):
self.run(sql10.format("touched_", "not_touched_"), self.callback10)
self.run(sql10.format("", "touched_"), self.callback10)

###########################################################################

Expand Down

0 comments on commit 51dc3b9

Please sign in to comment.