Talk:PyrouteLib

From OpenStreetMap Wiki
Jump to navigation Jump to search

I'd like to put more detailed instructions somewhere for beginners (like me). Should they go on this page?

Here is step-by-step what I've done:

wget http://planet.king-nerd.com/USA/20080229/Washington-20080229.osm.bz2
bunzip Washington-20080229.osm.bz2
svn checkout http://svn.openstreetmap.org/applications/routing/pyroute/
cd pyroute
python pyroute.py ../data/Washington-20080229.osm 21505268 26608779

This ate all my memory and then I killed it.

--Abie 16:54, 8 July 2008 (UTC)

TBH, I'd suggest trying something like:
svn co http://svn.openstreetmap.org/applications/routing/pyroutelib2/
python routeAsGpx.py [lat1] [lon1] [lat2] [lon2] [car|cycle|foot]
that will download data as required, and should be faster and use less memory. If you then need to download data for a large area, write a script based on the URLs and filenames in tiledata.py Ojw 17:26, 8 July 2008 (UTC)


Hi Ojw, I keep getting error in routeAsGpx.py on different .osm and .pbf (planet) files but I keep getting type errors where it can't concatenate string and int. I only try it on small metro extracts such as toronto.osm.pbf and also toronto.osm (uncompressed osm file) but I keep getting the error. I am also entering the coordinates that are within the bounds of the .osm file. In my Ubuntu linux command line, I enter: python routeAsGpx.py toronto.osm.pbf 43.667 -79.4000 43.725 -79.402 car but then I get this error:

Traceback (most recent call last):

 File "routeAsGpx.py", line 85, in <module>
   "track")
 File "routeAsGpx.py", line 31, in routeToGpx
   node1 = data.findNode(lat1,lon1)
 File "/home/peter/pyroutelib2/loadOsm.py", line 173, in findNode
   self.getArea(lat,lon)
 File "/home/peter/pyroutelib2/loadOsm.py", line 46, in getArea
   (x,y) = tilenames.tileXY(lat, lon, z)
 File "/home/peter/pyroutelib2/tilenames.py", line 30, in tileXY
   x,y = latlon2xy(lat,lon,z)
 File "/home/peter/pyroutelib2/tilenames.py", line 26, in latlon2xy
   x,y = latlon2relativeXY(lat,lon)
 File "/home/peter/pyroutelib2/tilenames.py", line 20, in latlon2relativeXY
   x = (lon + 180) / 360

TypeError: cannot concatenate 'str' and 'int' objects

Can you verify that I've entered all this correctly? Does your routeAsGpx.py script work on .pbf extract files as well as .osm files?

I believe I included all the parameters and I also try different variations such as foot or cycle.  Thanks for your help.

--Developingcountries 21:55, 29 December 2013 (UTC)