Hello Mr. Jakob, I am very sorry once again, but it still does not work. When I use this:
x2, y2 = net.convertLonLat2XY(lon, lat, rawUTM=True) I get these outputs to use in moveToXY: x2=4.956658 y2=22.982225 x2=5.009388 y2=34.633814 x2=5.097475 y2=45.349363 x2=4.368089 y2=57.215837 x2=4.624426 y2=69.318226 x2=5.126126 y2=81.546192 x2=4.925263 y2=95.019266 x2=4.932274 y2=108.620357 and the vehicle drives on the left side of the road. If I use what you said : x2, y2 = net.convertLonLat2XY(lon, lat) I get this kind of output: x2=-561578.553342 y2=-4188031.457775 x2=-561578.500612 y2=-4188019.806186 x2=-561578.412525 y2=-4188009.090637 x2=-561579.141911 y2=-4187997.224163 x2=-561578.885574 y2=-4187985.121774 x2=-561578.383874 y2=-4187972.893808 x2=-561578.584737 y2=-4187959.420734 x2=-561578.577726 y2=-4187945.819643 x2=-561578.277498 y2=-4187931.796405 x2=-561577.983976 y2=-4187918.083758 and the vehicle is nowhere to be seen. Is there anything I can do to fix this issue? Thak you very much for your help. ________________________________ Von: Jakob Erdmann <[email protected]> Gesendet: Dienstag, 9. Oktober 2018 08:56:19 An: Gama Lins de Araujo, Thais Cc: Sumo project User discussions; sumo-user Betreff: Re: [sumo-user] use State Plain Coordinates to move vehicle (MoveToXY) when converting lon, lat to network coordinates, leave out the rawUTM=True. moveToXY requires the shifted positions rather than raw UTM. x2, y2 = net.convertLonLat2XY(lon, lat) Am Di., 9. Okt. 2018 um 08:03 Uhr schrieb Gama Lins de Araujo, Thais <[email protected]<mailto:[email protected]>>: Hello Mr Jakob, I am sorry to bother again, but I replaced the line of code I had with the one you provided, and the simulation looks just the same. The vehicle drives by the side of the road the whole time, and it also seems not to have the right angle. This is how my code looks like now: x,y = df_dropped_1st_veh_instance['Local_X'].iloc[k], df_dropped_1st_veh_instance['Local_Y'].iloc[k] lon, lat = net.convertXY2LonLat(x * 0.3048, y * 0.3048, True) x2, y2 = net.convertLonLat2XY(lon, lat, rawUTM=True) traci.vehicle.moveToXY(traci_veh, '', 0, x2, y2, angle, 2) for the angle I used INVALID_DOUBLE_VALUE and transformed it to radians. Here is a sample of the data I have: Local_X Local_Y Global_X Global_Y 0 16.467 35.381 6451137.641 1873344.962 1 16.447 39.381 6451140.329 1873342.000 2 16.426 43.381 6451143.018 1873339.038 3 16.405 47.380 6451145.706 1873336.077 4 16.385 51.381 6451148.395 1873333.115 5 16.364 55.381 6451151.084 1873330.153 6 16.344 59.381 6451153.772 1873327.192 7 16.323 63.379 6451156.461 1873324.230 Thank you in advance, Thais Gama ________________________________ Von: Jakob Erdmann <[email protected]<mailto:[email protected]>> Gesendet: Montag, 8. Oktober 2018 12:51 An: Gama Lins de Araujo, Thais; Sumo project User discussions Cc: sumo-user Betreff: Re: [sumo-user] use State Plain Coordinates to move vehicle (MoveToXY) Hello, the position conversion functions provided by traci and libsumo only support the projection embedded in the .net.xml file. In case of an OSM import this means it will always transform between meters and WGS84 lon,lat. Since NAD83 and WGS84 are within 1m of each other, you could use net.convertXY2LonLat(x_feet * 0,3048, y_feet * 0,3048, True) (The third argument is for using raw UTM values instead adding the network offset) regards, Jakob Am Mo., 8. Okt. 2018 um 12:24 Uhr schrieb Gama Lins de Araujo, Thais via sumo-user <[email protected]<mailto:[email protected]>>: Hello Mr. Behrisch<https://sourceforge.net/u/behrisch/> / Erdmann<https://sourceforge.net/u/namdre/>, I would like to know if there is a way in SUMO that I can directly use CA State Plane NAD83 coordinate in feet to move vehicles in a network with the moveToXY command, or do I need to do any transformations before hand? When I use this piece of code (I got from http://sumo.dlr.de/wiki/Tools/Sumolib#coordinate_transformations) I seem to get reasonable results for latitude and longitude, but the x and y resulting from conversion are not matching the network. When I run this code: x,y = df_dropped_1st_veh_instance['Local_X'].iloc[k], df_dropped_1st_veh_instance['Local_Y'].iloc[k] #x, y = traci.vehicle.getPosition(traci_veh) lon, lat = traci.simulation.convertGeo(x, y) x2, y2 = traci.simulation.convertGeo(lon, lat, fromGeo=True) #x, y = net.convertLonLatXY(lon, lat) print 'x=%4.6f y=%4.6f' % (x2, y2) the vehicle drives off the road network the whole time. In this case I am using the local coordinates (Local_X and Local_Y) which are described as: "Lateral (X) coordinate of the front center of the vehicle with respect to the left-most edge of the section in the direction of travel". When I use the Global coordinates (Global_X and Global_Y) my vehicle will just stand outside the network for the whole time, and those are the actual geo coordinates, described as such: "CA State Plane NAD83 coordinate". i know my network is in datum=WGS84, by the information given in the network xml file, and that it is shifted by the netOffset parameter. I wonder if that might be the problem? <location netOffset="-561583.51,-4188054.44" convBoundary="205.71,83.75,327.03,729.01" origBoundary="-122.300034,37.837827,-122.295689,37.846489" projParameter="+proj=utm +zone=10 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"/> PS.: i need high accuracy and precision, the vehicles should move exactly according to my coordinates, provided in the data I have. The data is very big (more than 1Gb), so I am sending only a subset of it, which refers to one car only. And also my code and files to run the simulation, in case those are needed. Thank you in advance for your help, Thais _______________________________________________ sumo-user mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/sumo-user _______________________________________________ sumo-user mailing list [email protected]<mailto:[email protected]> To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/sumo-user _______________________________________________ sumo-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sumo-user
