GIScience / orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice API´s, based on openstreetmap
https://plugins.qgis.org/plugins/ORStools/
MIT License
92 stars 31 forks source link

python errors since upgraded tool to current version #37

Closed wmeinolf closed 6 years ago

wmeinolf commented 6 years ago

First of all many thanks for introducing this very useful tool. Since about a week or two I get python errors when using the tool. Before I upgraded the tool to the currenr version it worked like a charm. I get errors not always but most times. Im now on QGIS 2.18.14, as it happened at 2.18.13,. I also tried long term QGIS release 2.14.20, same thing. As I recently upgraded OSM Tools from 0.3 to 0.3.4 I also tried to downgrade to various versions, no change, it still happens.

Here the trace: 2017-10-30T14:07:11 1 Traceback (most recent call last):

File "C:/Users/User/.qgis2/python/plugins\OSMtools\osm_tools.py", line 265, in run self.route_anal.route() File "C:/Users/User/.qgis2/python/plugins\OSMtools\osm_tools_routing.py", line 223, in route loc_dict = _point_geo.reverseGeocode(point_geom) File "C:/Users/User/.qgis2/python/plugins\OSMtools\osm_tools_geocode.py", line 38, in reverseGeocode root = json.loads(response.text) File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\json__init__.py", line 338, in loads return _default_decoder.decode(s) File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\json\decoder.py", line 365, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\json\decoder.py", line 383, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

I appreciate your help. What else can I do to fix the issue? Thanks again and best regards from Germany.

nilsnolde commented 6 years ago

@wmeinolf sorry, I was away on vacation for 4 weeks. I´ll look into it asap and keep you posted. It looks like it has problems in the reverse geocode section. Maybe ORS changed smth in the response.

nilsnolde commented 6 years ago

Hi @wmeinolf,

as I´m working on a temp laptop right now, I did an entirely fresh install of QGIS and OSM tools, and I cannot reproduce your issue. And despite seriously lots of debugging in the past, I never came across that one, though my memory might elude me too..

It´s a weird error, that shouldn´t be raised really.. No matter what you´re doing, you should always get a JSON object back, with an error in the worst case, but there HAS to be one. So, I´d ask you for a few things to narrow down the options:

And let me know what the result was. It should return this feature collection: bildschirmfoto 2017-11-23 um 14 53 24

Thanks Nils

blaugelb commented 6 years ago

Hey guys, sounds pretty similar to my problem, although I’m not exatly sure if my issue is a real bug or if I’m just using the plugin the wrong way.

I start QGIS, create a new Project and load OSM via the Open Layers Plugin. Then I start OSM Tools, my API KEY is already inserted. I choose “Accessibility Areas” and then “Map Now!”. The OSM Tools Window goes to the background and there’s a special crosshair cursor for choosing the location. When I click somewhere to choose the location, the OSM Tools windows in the background closes and nothing else happens. I also tried importing an Layer with two points, starting OSM Tools and instead of click “Map now!” I choose the Layer and then click OK. Then I get this Python error:

2018-01-04T15:29:52 1 Traceback (most recent call last): File "C:/Users/###/.qgis2/python/plugins\OSMtools\osm_tools.py", line 262, in run self.access_anal.iterAnalysis() File "C:/Users/###/.qgis2/python/plugins\OSMtools\osm_tools_access.py", line 382, in iterAnalysis feat_list, isochrone_list = self.accRequest(feat_in_list) File "C:/Users/###/.qgis2/python/plugins\OSMtools\osm_tools_access.py", line 164, in accRequest response = requests.get(req) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\api.py", line 70, in get return request('get', url, params=params, **kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\api.py", line 56, in request return session.request(method=method, url=url, **kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\sessions.py", line 488, in request resp = self.send(prep, **send_kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\sessions.py", line 609, in send r = adapter.send(request, **kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\adapters.py", line 497, in send raise SSLError(e, request=request) SSLError: bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)

If I click the python error away there’s a progress bar “Requesting analysis from ORS..” that stays at 0%.

When I try “Routing” and I choose the Start and End Map Coordinates, the Python error is this one: 2018-01-04T15:36:21 1 Traceback (most recent call last): File "C:/Users/###/.qgis2/python/plugins\OSMtools\osm_tools.py", line 265, in run self.route_anal.route() File "C:/Users/###/.qgis2/python/plugins\OSMtools\osm_tools_routing.py", line 223, in route loc_dict = _point_geo.reverseGeocode(point_geom) File "C:/Users/###/.qgis2/python/plugins\OSMtools\osm_tools_geocode.py", line 37, in reverseGeocode response = requests.get(req) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\api.py", line 70, in get return request('get', url, params=params, **kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\api.py", line 56, in request return session.request(method=method, url=url, **kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\sessions.py", line 488, in request resp = self.send(prep, **send_kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\sessions.py", line 609, in send r = adapter.send(request, **kwargs) File "C:\PROGRA~2\QGIS2~1.14\apps\Python27\lib\site-packages\requests\adapters.py", line 497, in send raise SSLError(e, request=request) SSLError: bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)

If I load your link ( https://api.openrouteservice.org/geocoding?lang=en&api_key=yourkey&location=9.32368,49.34978) with my Key I get this answer: {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[9.330492,49.350061]},"properties":{"country":"Germany","country_code":"DE","county":"Heilbronn","region":"Baden-Württemberg","street":"Hofbrunnen","name":"Hofbrunnen","place_type":"street","distance":494.43,"confidence":0.6}}],"bbox":[9.330492,49.350061,9.330492,49.350061],"info":{"engine":{"version":"4.4.0","build_date":"2017-10-26T10:12:59Z"},"service":"geocoding","query":{"limit":1,"location":[9.32368,49.34978]},"attribution":"openrouteservice.org | OpenStreetMap contributors | Who's On First, whosonfirst.mapzen.com | GeoNames, www.geonames.org","timestamp":1515077175649}}

Is there something I do wrong or can you help me somehow? The plugin sounds really great and would help me a lot.

Thanks in advance!

wmeinolf commented 6 years ago

Hi @nilsnolde , first of all a happy und succesful year to you ansd y apologises, that I did not respond to your last advise. Reason was a high workload and the fact, that one day the tool began to work again perfectly.

Hi @blaugelb , Back when I encountered the issues, i always used the "routing" function, not “Accessibility Areas”! As I just mentioned, the tool now works perfectly, so I suspect, the reason for the python error was not the tool, but more likely ORS. Also you may have missed, that this issue has already been closed. So it may be a good idea, to open a new issue on your problem. br wmeinolf