Skip to content

Commit b56f923

Browse files
committed
Fixing/Using issues found by rabbit
1 parent 5bf5d8d commit b56f923

14 files changed

+43
-45
lines changed

functions/CostBase.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,31 @@ def getExportQuery(self, args):
6363
WITH
6464
result AS ( {result_query} ),
6565
departure AS (
66-
SELECT start_vid, end_vid, ST_startPoint(geom) AS depart
67-
FROM result JOIN {edge_table} ON ({edge_table}.{source} = start_vid)
68-
69-
UNION
70-
71-
SELECT start_vid, end_vid, ST_endPoint(geom)
72-
FROM result JOIN {edge_table} ON ({edge_table}.{target} = start_vid)
73-
),
74-
66+
SELECT DISTINCT ON (start_vid, end_vid)
67+
start_vid, end_vid,
68+
CASE
69+
WHEN {edge_table}.{source} = start_vid
70+
THEN ST_StartPoint({edge_table}.{geometry})
71+
ELSE ST_EndPoint({edge_table}.{geometry})
72+
END AS depart
73+
FROM result
74+
JOIN {edge_schema}.{edge_table}
75+
ON ({edge_table}.{source} = start_vid OR {edge_table}.{target} = start_vid)
76+
ORDER BY start_vid, end_vid, {edge_table}.{id}
77+
),
7578
destination AS (
76-
SELECT start_vid, end_vid, ST_startPoint(geom) AS arrive
77-
FROM result JOIN {edge_table} ON ({edge_table}.{source} = end_vid)
78-
79-
UNION
80-
81-
SELECT start_vid, end_vid, ST_endPoint(geom)
82-
FROM result JOIN {edge_table} ON ({edge_table}.{target} = end_vid)
83-
)
79+
SELECT DISTINCT ON (start_vid, end_vid)
80+
start_vid, end_vid,
81+
CASE
82+
WHEN {edge_table}.{source} = end_vid
83+
THEN ST_StartPoint({edge_table}.{geometry})
84+
ELSE ST_EndPoint({edge_table}.{geometry})
85+
END AS arrive
86+
FROM result
87+
JOIN {edge_schema}.{edge_table}
88+
ON ({edge_table}.{source} = end_vid OR {edge_table}.{target} = end_vid)
89+
ORDER BY start_vid, end_vid, {edge_table}.{id}
90+
)
8491
8592
SELECT result.*, ST_MakeLine(depart, arrive) AS path_geom
8693

functions/FunctionBase.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ def drawCostPaths(self, rows, con, args, geomType, canvasItemList, mapCanvas):
283283

284284
# Label the edge
285285
midPoint = PgrQ.getMidPoint()
286-
midPointstr = midPoint.as_string(con)
287286
midPointCursor.execute(midPoint,(line,))
288287
pointRow = midPointCursor.fetchone()
289288
# Utils.logMessage("The point:" + str(pointRow[0]))

functions/pgr_aStar.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
class Function(AstarBase):
3232

33-
minPGRversion = 2.4
34-
3533
def __init__(self, ui):
3634
AstarBase.__init__(self, ui)
3735

functions/pgr_aStarCost.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
class Function(CostBase):
3232

33-
minPGRversion = 2.4
34-
3533
def __init__(self, ui):
3634
CostBase.__init__(self, ui)
3735

functions/pgr_bdAstar.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
class Function(AstarBase):
3232

33-
minPGRversion = 2.5
34-
3533
def __init__(self, ui):
3634
AstarBase.__init__(self, ui)
3735

functions/pgr_bdAstarCost.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
class Function(CostBase):
3232

33-
minPGRversion = 2.5
34-
3533
def __init__(self, ui):
3634
CostBase.__init__(self, ui)
3735

functions/pgr_bdDijkstra.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
class Function(DijkstraBase):
3131

32-
minPGRversion = 2.5
33-
3432
def __init__(self, ui):
3533
DijkstraBase.__init__(self, ui)
3634

functions/pgr_bdDijkstraCost.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
class Function(CostBase):
3232

33-
minPGRversion = 2.5
34-
3533
def __init__(self, ui):
3634
CostBase.__init__(self, ui)
3735

functions/pgr_dijkstra.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
class Function(DijkstraBase):
3131

32-
minPGRversion = 2.1
33-
3432
def __init__(self, ui):
3533
DijkstraBase.__init__(self, ui)
3634

functions/pgr_dijkstraCost.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
class Function(CostBase):
3232

33-
minPGRversion = 2.2
34-
3533
def __init__(self, ui):
3634
CostBase.__init__(self, ui)
3735

0 commit comments

Comments
 (0)