Skip to content

Commit 40ac871

Browse files
add: latitude and longitude support
1 parent 74ea61d commit 40ac871

File tree

6 files changed

+14
-6
lines changed

6 files changed

+14
-6
lines changed
12.4 KB
Binary file not shown.
9.01 KB
Binary file not shown.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = trafficinterventions
3-
version = 2.0.2
3+
version = 2.0.3
44
author = WSL, IIITB
55
author_email = WSL1@iiitb.ac.in
66
description = Python Package to perform simple Traffic Interventions and run traffic simulations.

src/trafficinterventions.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: trafficinterventions
3-
Version: 2.0.2
3+
Version: 2.0.3
44
Summary: Python Package to perform simple Traffic Interventions and run traffic simulations.
55
Home-page: https://github.com/WSL-IIITB/Traffic-Interventions
66
Author: WSL, IIITB

src/trafficinterventions/EmissionJunction.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,16 @@ def loop(self):
128128

129129
for i in range(locs):
130130
traci.gui.toggleSelection(junctions[max_list[i][0]].getID(), objType='junction')
131+
131132
f = open(self.pathSummaryFile, 'w')
132-
133133
for i in range(locs):
134134
traci.gui.toggleSelection(junctions[total_emissions_list[i][0]].getID(), objType='junction')
135-
f.write(str(junctions[total_emissions_list[i][0]].getID())+'\n')
135+
136+
x,y = traci.junction.getPosition(junctions[total_emissions_list[i][0]].getID())
137+
lon, lat = traci.simulation.convertGeo(x, y)
138+
lon, lat = self.net.convertXY2LonLat(x, y)
139+
140+
f.write(str(junctions[total_emissions_list[i][0]].getID())+ +" Coordinates:" + str(lat) + " " + str(lon) + '\n')
136141
f.close()
137142

138143
filename = self.outPath+'screenshots/aggregate.jpg'

src/trafficinterventions/StressJunction.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,14 @@ def loop(self):
234234

235235
for i in range(locs):
236236
traci.gui.toggleSelection(junctions[max_list[i][0]].getID(), objType='junction')
237-
f = open(self.pathSummaryFile, 'w')
238237

238+
f = open(self.pathSummaryFile, 'w')
239239
for i in range(locs):
240240
traci.gui.toggleSelection(max_stressed[i][0], objType='junction')
241-
f.write(str(max_stressed[i][0])+'\n')
241+
x,y = traci.junction.getPosition(max_stressed[i][0])
242+
lon, lat = traci.simulation.convertGeo(x, y)
243+
lon, lat = self.net.convertXY2LonLat(x, y)
244+
f.write(str(max_stressed[i][0])+" Coordinates:" + str(lat) + " " + str(lon) + '\n')
242245
f.close()
243246

244247
filename = self.outPath+'stress/screenshots/aggregate.jpg'

0 commit comments

Comments
 (0)