From: Daniel K. <d.k...@we...> - 2008-09-25 06:40:30
|
Hello Nicholas, yes, this also came into my mind last night. There is a python module which can do that, <SUMO>\tools\lib\sumonet.py. For an usage example, see <SUMO>\tools\lib\netextract.py. I hope this helps. Daniel > -----Ursprüngliche Nachricht----- > Von: "Nicholas Loulloudes" <lou...@cs...> > Gesendet: 25.09.08 08:15:48 > An: Daniel Krajzewicz <d.k...@we...> > CC: SUMO <sum...@li...> > Betreff: Re: [sumo-user] Creating SUMO Routes from NS-2 Mobility > Dear Daniel, > > could you point me the way to any existing code fragment for parsing and > loading a SUMO network file into an appropriate data structure (C or Java). > > Thanks in advance. > > - Nicholas. > > Daniel Krajzewicz wrote: > > Dear Nicholas, > > > > I suppose you can code!? > > > > a) load the network > > b) go through each trace > > c) find the nearest edge for each point in your trace (code: see below) > > d) build route using each found edge once > > > > Now, honestly, the issue is, that the nearest edge may be not the one the vehicle used, but the opposite one. I think this should not really be the case unless the trace includes GPS-errors or something like this. > > > > Still, if it is the case, you maybe should try not to keep the edges you found, but rather the nodes they connect, and then, in a second path, search the edges that connect the nodes in the proper direction. > > > > sincerely, > > Daniel > > > > > > code for c) (from <sumo>/src/utils/geom/line2d.cpp; returns -1 if the point is not on a normal of the line): > > SUMOReal > > Line2D::distanceTo(const Position2D &p) const > > { > > SUMOReal LineMag; > > SUMOReal U; > > > > LineMag = GeomHelper::Magnitude(myP2, myP1); > > > > U = (((p.x() - myP1.x()) * (myP2.x() - myP1.x())) + > > ((p.y() - myP1.y()) * (myP2.y() - myP1.y())) /*+ > > ( ( Point->Z - LineStart->Z ) * ( LineEnd->Z - LineStart->Z ) ) )*/ > > ) > > / > > (LineMag * LineMag); > > > > if (U < 0.0f || U > 1.0f) > > return -1; // closest point does not fall within the line segment > > > > Position2D Intersection( > > myP1.x() + U *(myP2.x() - myP1.x()), > > myP1.y() + U *(myP2.y() - myP1.y())); > > // Intersection.Z = LineStart->Z + U * ( LineEnd->Z - LineStart->Z ); > > > > SUMOReal Distance = GeomHelper::Magnitude(p, Intersection); > > > > return Distance; > > } > > > > > > > > > >> -----Ursprüngliche Nachricht----- > >> Von: "Nicholas Loulloudes" <lou...@cs...> > >> Gesendet: 23.09.08 17:00:45 > >> An: Axel Wegener <we...@it...> > >> CC: suMO <sum...@li...> > >> Betreff: Re: [sumo-user] Creating SUMO Routes from NS-2 Mobility > >> > > > > > > > >> Hi, > >> > >> yes i have the road map but unfortunately the mobility traces which i > >> have are in NS-2 format. > >> > >> In addition the granularity of the x-y traces for each node is not > >> constant at each second of the simulation. > >> > >> Thanks. > >> > >> Axel Wegener wrote: > >> > >>> Hello, > >>> > >>> that sounds a little bit tricky, since ns2 mobility is given most > >>> times in x-y-coordinates. To extract sumo routes you have to map from > >>> x-y to roads, lanes and the longitudinal positions on the lane. Do you > >>> have the appropriate road map? > >>> > >>> I am afraid you have to code this on your own. But feel free to spent > >>> the results to the community. > >>> > >>> Best wishes > >>> Axel > >>> > >>> Nicholas Loulloudes schrieb: > >>> > >>>> Hello all, > >>>> > >>>> Do you know whether it is possible to create SUMO routes from already > >>>> given NS-2 mobility trace file? > >>>> > >>>> Thanks in advance. > >>>> > >>>> ------------------------------------------------------------------------ > >>>> > >>>> ------------------------------------------------------------------------- > >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > >>>> Build the coolest Linux based applications with Moblin SDK & win great prizes > >>>> Grand prize is a trip for two to an Open Source event anywhere in the world > >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >>>> ------------------------------------------------------------------------ > >>>> > >>>> _______________________________________________ > >>>> sumo-user mailing list > >>>> sum...@li... > >>>> https://lists.sourceforge.net/lists/listinfo/sumo-user > >>>> > >>>> > >>> -- > >>> > >>> /Axel Wegener/ > >>> Universität zu Lübeck > >>> Institut für Telematik > >>> Ratzeburger Allee 160 / Geb. 64 > >>> D-23538 Lübeck, Germany > >>> > >>> Tel: +49 (451) 500-5385, Fax: -5382 > >>> Email: we...@it... <mailto:we...@it...> > >>> WWW: http://www.itm.uni-luebeck.de > >>> > >>> > >> -- > >> _________________________________________________ > >> > >> Nicholas Loulloudes > >> High Performance Computing Systems Laboratory (HPCL) > >> University of Cyprus, > >> Nicosia, Cyprus > >> > >> Tel: +357-22892663 > >> Email: loulloudes.n[at]cs.ucy.ac.cy > >> > >> > >> > >> > >> > >> <hr> > >> ------------------------------------------------------------------------- > >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > >> Build the coolest Linux based applications with Moblin SDK & win great prizes > >> Grand prize is a trip for two to an Open Source event anywhere in the world > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> > >> <hr> > >> _______________________________________________ > >> sumo-user mailing list > >> sum...@li... > >> https://lists.sourceforge.net/lists/listinfo/sumo-user > >> > >> > >> > > > > > > ____________________________________________________________________ > > Psssst! Schon vom neuen WEB.DE MultiMessenger gehört? > > Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123 > > > > > > > -- > _________________________________________________ > > Nicholas Loulloudes > High Performance Computing Systems Laboratory (HPCL) > University of Cyprus, > Nicosia, Cyprus > > Tel: +357-22892663 > Email: loulloudes.n[at]cs.ucy.ac.cy > > > _________________________________________________________________________ In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114 |