Obtain GEO Coordinates from sumo simulation using TraCI
I am using TraCI library in python to launch and control a sumo simulation from code, step by step.
My problem is that I need the coordinates of the vehicles in lat, lon UTM evey step of the simulation. I obtain the x,y coordinates from the simulation every step with a TraCI listener and then I try to convert these values to lat and lon:
for vehicleId in traci.vehicle.getIDList():
speed = traci.vehicle.getSpeed(vehicleId)
x, y = traci.vehicle.getPosition(vehicleId)
lon, lat = traci.simulation.convertGeo(x, y)
lon, lat = self.net.convertXY2LonLat(x, y)
None of the two conversions work, first one returns the same values and the second one usually throws an error:
"RuntimeError: b'projection not named'"
Which I guess is because there is no projection properly described in the network file. Problem here is that NONE of the scenarios work here, even though some of them can do the fcd-output (projected coordinates).
Does any one have encountered a similar problem?
Regards and thank you!
python simulation sumo
add a comment |
I am using TraCI library in python to launch and control a sumo simulation from code, step by step.
My problem is that I need the coordinates of the vehicles in lat, lon UTM evey step of the simulation. I obtain the x,y coordinates from the simulation every step with a TraCI listener and then I try to convert these values to lat and lon:
for vehicleId in traci.vehicle.getIDList():
speed = traci.vehicle.getSpeed(vehicleId)
x, y = traci.vehicle.getPosition(vehicleId)
lon, lat = traci.simulation.convertGeo(x, y)
lon, lat = self.net.convertXY2LonLat(x, y)
None of the two conversions work, first one returns the same values and the second one usually throws an error:
"RuntimeError: b'projection not named'"
Which I guess is because there is no projection properly described in the network file. Problem here is that NONE of the scenarios work here, even though some of them can do the fcd-output (projected coordinates).
Does any one have encountered a similar problem?
Regards and thank you!
python simulation sumo
1
Can you share your scenario somewhere? If the fcd-output can do geo coordinates then traci should be able to do it as well.
– Michael
Nov 29 '18 at 17:46
Sorry, problem was the network, not being geo referenced. Check my answer which I forgot to post!
– Adrián Arroyo Perez
Nov 30 '18 at 10:58
add a comment |
I am using TraCI library in python to launch and control a sumo simulation from code, step by step.
My problem is that I need the coordinates of the vehicles in lat, lon UTM evey step of the simulation. I obtain the x,y coordinates from the simulation every step with a TraCI listener and then I try to convert these values to lat and lon:
for vehicleId in traci.vehicle.getIDList():
speed = traci.vehicle.getSpeed(vehicleId)
x, y = traci.vehicle.getPosition(vehicleId)
lon, lat = traci.simulation.convertGeo(x, y)
lon, lat = self.net.convertXY2LonLat(x, y)
None of the two conversions work, first one returns the same values and the second one usually throws an error:
"RuntimeError: b'projection not named'"
Which I guess is because there is no projection properly described in the network file. Problem here is that NONE of the scenarios work here, even though some of them can do the fcd-output (projected coordinates).
Does any one have encountered a similar problem?
Regards and thank you!
python simulation sumo
I am using TraCI library in python to launch and control a sumo simulation from code, step by step.
My problem is that I need the coordinates of the vehicles in lat, lon UTM evey step of the simulation. I obtain the x,y coordinates from the simulation every step with a TraCI listener and then I try to convert these values to lat and lon:
for vehicleId in traci.vehicle.getIDList():
speed = traci.vehicle.getSpeed(vehicleId)
x, y = traci.vehicle.getPosition(vehicleId)
lon, lat = traci.simulation.convertGeo(x, y)
lon, lat = self.net.convertXY2LonLat(x, y)
None of the two conversions work, first one returns the same values and the second one usually throws an error:
"RuntimeError: b'projection not named'"
Which I guess is because there is no projection properly described in the network file. Problem here is that NONE of the scenarios work here, even though some of them can do the fcd-output (projected coordinates).
Does any one have encountered a similar problem?
Regards and thank you!
python simulation sumo
python simulation sumo
asked Nov 20 '18 at 14:49


Adrián Arroyo PerezAdrián Arroyo Perez
988
988
1
Can you share your scenario somewhere? If the fcd-output can do geo coordinates then traci should be able to do it as well.
– Michael
Nov 29 '18 at 17:46
Sorry, problem was the network, not being geo referenced. Check my answer which I forgot to post!
– Adrián Arroyo Perez
Nov 30 '18 at 10:58
add a comment |
1
Can you share your scenario somewhere? If the fcd-output can do geo coordinates then traci should be able to do it as well.
– Michael
Nov 29 '18 at 17:46
Sorry, problem was the network, not being geo referenced. Check my answer which I forgot to post!
– Adrián Arroyo Perez
Nov 30 '18 at 10:58
1
1
Can you share your scenario somewhere? If the fcd-output can do geo coordinates then traci should be able to do it as well.
– Michael
Nov 29 '18 at 17:46
Can you share your scenario somewhere? If the fcd-output can do geo coordinates then traci should be able to do it as well.
– Michael
Nov 29 '18 at 17:46
Sorry, problem was the network, not being geo referenced. Check my answer which I forgot to post!
– Adrián Arroyo Perez
Nov 30 '18 at 10:58
Sorry, problem was the network, not being geo referenced. Check my answer which I forgot to post!
– Adrián Arroyo Perez
Nov 30 '18 at 10:58
add a comment |
1 Answer
1
active
oldest
votes
Problem was that the networks where not geo-referenced properly. It is needed that the projection parameter is '+proj=utm ...' instead of '!'.
This means any fcd-output you are getting is also provided in terms of x,y (cartesian) network coordinates. Likewise, the lower left-right corner in sumo-gui will not provide correct lat,lon values for such a network.
Refer to this issue.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395588%2fobtain-geo-coordinates-from-sumo-simulation-using-traci%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Problem was that the networks where not geo-referenced properly. It is needed that the projection parameter is '+proj=utm ...' instead of '!'.
This means any fcd-output you are getting is also provided in terms of x,y (cartesian) network coordinates. Likewise, the lower left-right corner in sumo-gui will not provide correct lat,lon values for such a network.
Refer to this issue.
add a comment |
Problem was that the networks where not geo-referenced properly. It is needed that the projection parameter is '+proj=utm ...' instead of '!'.
This means any fcd-output you are getting is also provided in terms of x,y (cartesian) network coordinates. Likewise, the lower left-right corner in sumo-gui will not provide correct lat,lon values for such a network.
Refer to this issue.
add a comment |
Problem was that the networks where not geo-referenced properly. It is needed that the projection parameter is '+proj=utm ...' instead of '!'.
This means any fcd-output you are getting is also provided in terms of x,y (cartesian) network coordinates. Likewise, the lower left-right corner in sumo-gui will not provide correct lat,lon values for such a network.
Refer to this issue.
Problem was that the networks where not geo-referenced properly. It is needed that the projection parameter is '+proj=utm ...' instead of '!'.
This means any fcd-output you are getting is also provided in terms of x,y (cartesian) network coordinates. Likewise, the lower left-right corner in sumo-gui will not provide correct lat,lon values for such a network.
Refer to this issue.
answered Nov 30 '18 at 10:57


Adrián Arroyo PerezAdrián Arroyo Perez
988
988
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395588%2fobtain-geo-coordinates-from-sumo-simulation-using-traci%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Can you share your scenario somewhere? If the fcd-output can do geo coordinates then traci should be able to do it as well.
– Michael
Nov 29 '18 at 17:46
Sorry, problem was the network, not being geo referenced. Check my answer which I forgot to post!
– Adrián Arroyo Perez
Nov 30 '18 at 10:58