MKuranowski / pyroutelib3

Simple routing over OpenStreetMap data
https://pyroutelib3.readthedocs.io/
GNU General Public License v3.0
79 stars 24 forks source link

Hi, #11

Closed filclem closed 5 years ago

filclem commented 5 years ago

Hi, may be a bug ? I've got a problem with these adresses and only these (foot or car also and first time unclosed token error) :

coor_depart = [ 50.72046, 1.61538]      
coor_arrivee= [50.72712, 1.60874]   
router = Router("foot")
depart = router.findNode(coor_depart[0], coor_depart[1])
arrivee = router.findNode(coor_arrivee[0], coor_arrivee[1])
status, route = router.doRoute(depart, arrivee)

in the folder : tilescache , files are created without end (exemple : Capture du 2019-04-09 12-08-18

with a osm file in the folder, it stop (a little box including the points) but with no issue.

i'm just testing it again, unclosed token error message again !

Originally posted by @filclem in https://github.com/MKuranowski/pyroutelib3/issues/3#issuecomment-481232148

MKuranowski commented 5 years ago

(Moved issue to here)

Please post a traceback, I kinda don't know what you're talking about 😕

But, like a said previously The traceback shows an issue with reading the OSM data, so it's probably an issue in them.

Unclosed Token Error is raised by the XML ETree parser, not by pyroutelib3.

Like I mentioned earlier, it's better to handle OSM data on your own. Can you try reproducing it when using your own .osm file?

filclem commented 5 years ago

How can i do the traceback ? router.report() print : Loaded 1703 nodes Loaded 1703 foot routes

MKuranowski commented 5 years ago

When an error is raised in Python (or like, any other modern programming language), there's a traceback of the error, like this:

Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more informatio
>>> assert False
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
>>>
filclem commented 5 years ago

i try :-1:

import traceback

try:
    status, route = router.doRoute(depart, arrivee)
except Exception as ex:
    traceback.print_exc()    

no result, no error

filclem commented 5 years ago
(base) philippe@philippe-K55A:~$ python3
Python 3.7.1 (default, Dec 14 2018, 19:28:38) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> assert False
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError

i just retry without map.osm: (with no errors like " unclosed token ", this time !)

coor_depart= [ 50.72046, 1.61538]          
coor_arrivee= [50.72712, 1.60874]      # bug
#router = Router("foot","map.osm")
router = Router("foot")

files and folder are created with no end, no errors..

filclem commented 5 years ago

the last file data.osm give points out of range <node id="22602682" visible="true" version="6" changeset="67069763" timestamp="2019-02-10T11:55:02Z" user="patman37" uid="311391" lat="50.7229151" lon="1.5879760"/>

MKuranowski commented 5 years ago

I think I see, you mentioned the unclosed token error, but the issue is that the router.doRoute just hangs.

Ok, but does it work with map.osm?

filclem commented 5 years ago

sometimes i have the message : unclosed token error, and sometimes not, and a lot of files a created with no end ! randomized !

with the file map.osm, i think the program stop after reading last nodes

filclem commented 5 years ago

with the file map.osm, the fonction/pyroutelib3 : router.report() print (after : status indicate : ### no_route)

Loaded 1703 nodes
Loaded 1703 foot routes
MKuranowski commented 5 years ago

Well, if status == no_route, then that's a valid result of the A* algorithm: no route exists on the given graph.

But as far as I remember, the graph has to be fully traversed [there's a hard-coded limit in pyroutelib3, but it's pretty huge] by A* to conclude that no route exists. This means that when downloading data, the whole Earth has to be downloaded.

This is probably an issue with OSM data itself: some access tags are probably incorrect.

filclem commented 5 years ago

OK. Thanks. one more question : have you testing my points ? from [ 50.72046, 1.61538] to [50.72712, 1.60874] you have the route or no_route like me ? It is always the same issue ? (if datas don't change) because, just 10 meters far away (50.72735,1.60825) for destination, result is good ! with or without map.osm

MKuranowski commented 5 years ago

It's an issue with OSM data.

The coor_arrivee point maps to osm node 2288342894, which is not connected to the ~end~ start node by any way. To be strict, you can get to your target only from 4 other points, as Place Zamenhof is disconnected from any other roads.

MKuranowski commented 5 years ago

fixed in https://www.openstreetmap.org/changeset/69050716