qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.43k stars 2.99k forks source link

QGIS crashes when calculating Shortest Path (Road Graph) with attached shapefile #17804

Closed qgib closed 5 years ago

qgib commented 10 years ago

Author Name: Jonas Ohlund (Jonas Ohlund) Original Redmine Issue: 9174 Affected QGIS version: master Redmine category:c++_plugins


New description:

with the attached shape "vagkartan_sv.zip" the road graph plugin crashes QGIS (tested on multiple platforms, and qgis 2.0/master).

The shape afer being cleaned with GRASS works as expected.


Old description:

Hello GIS-Pros,

I really need your help!

I'm a real newbie so please forgive me if this is a stupid post but I couldn't find a solution anywhere. I'm studying Urban and Regional planning at Stockholm University and right now we're doing this GIS project. The university uses ArcGis to train us but since I would like to be able to improve my skills at home on a mac, QGIS sounded like the perfect solution. Most of our teachers really promotes QGIS as a good alternative and we're allowed to use it for this project as long as we can make it work. After going through the pretty advanced installation process with some errors regarding the version of R which I sorted out eventually, I was thrilled to see QGIS working and I was feeling good about this project since I now would be able to do it on my own computer. So far, so good..

For this project we need to calculate shortest path and other basic network analysis stuff and we're using geodata from Swedish government institutions (shapefiles). I'm loading a vector data shapefile with roads for a certain area into QGIS. Then I go 'Vector' > 'Road Graph' > 'Settings' and select the current layer, then 'ok'. Using 'Shortest Path' I select 'start' and 'stop' on the road net and hit 'calculate' and then QGIS quits unexpectedly. Every single time!

I've tried everything I can think of:

Nothing seems to work and I can't find anybody online with the same problem (Shortest Path hangs QGIS). You guys are my last hope. And I need to get going really fast with this project that is due to be handed in before Xmas. If I cant sort this out during the weekend I'll have to install parallels and run ArcGIS or use ArcGIS at school.

I must have missed something right? Something really simple? Three different crash reports are attached. Please help me!

Many many thanks in advance! Contact me at: ohlund.jonas@gmail.com if you need further information to help me solve this.

Kind regards, Jonas Öhlund Stockholm University Department of Human Geography



Related issue(s): #17809 (relates) Redmine related issue(s): 9180


qgib commented 10 years ago

Author Name: Giovanni Manghi (@gioman)


it does not seems to crash while testing under Linux and Windows. Se please:

) test on another platform and/or mac to try find if is a local issue or a platform issue ) attach here a sample of your data, so we can test if the issue is data-dependent


qgib commented 10 years ago

Author Name: Richard Duivenvoorde (@rduivenvoorde)


Yep, here on debian too: both 2.01 and master are working fine.

@jonas I'll sent you zip file with some dutch roads (epsg:28992) which 'just works' on linux.

if you still encounter problems, I think it is either a mac-packaging problem, or a mac-python problem.

please let us know, so we can assign this problem to somebody developing/packaging for macs (these are thin though) then.

Fastest bet I think is either parallels and install ubuntu or debian, or windows. Another options maybe: find a intel machine and use the osgeo4w live cd with qgis on it: http://live.osgeo.org/en/index.htm?

qgib commented 10 years ago

Author Name: Jonas Ohlund (Jonas Ohlund)


Hi again,

Many thanks for your quick assistance! It worked with Richards dutch shape file which brings me some hope in solving this problem. But how to work around the issue and what's the real problem? For this project we have to use a big number of shapefiles from the swedish government (the same ones that are not working for me). Any idea what I'm doing wrong or how to work around it?

I've attached a simple road shape file thats not working for me. (epsg: 3006)

You made my day! Thanks, Jonas



qgib commented 10 years ago

Author Name: Richard Duivenvoorde (@rduivenvoorde)


Crash confirmed here. Attached shp files crash both 2.0 and current master on Linux.

Running QGIS via strace and output attached. Hope this is helpfull.



qgib commented 10 years ago

Author Name: Giovanni Manghi (@gioman)


Jonas Ohlund wrote:

Hi again,

Many thanks for your quick assistance! It worked with Richards dutch shape file which brings me some hope in solving this problem. But how to work around the issue and what's the real problem? For this project we have to use a big number of shapefiles from the swedish government (the same ones that are not working for me). Any idea what I'm doing wrong or how to work around it?

I've attached a simple road shape file thats not working for me. (epsg: 3006)

yeah, with your data the tool crashes qgis, anyway it seems it something data related. I attached a copy of your data after a pass with GRASS v.clean (using th processing toolbox) tool and then it works without issues.



qgib commented 10 years ago

Author Name: Richard Duivenvoorde (@rduivenvoorde)


yep, confirmed here. The v.cleaned data works.

Thinking it was a data related issue, I already tried to resave the shape via QGIS this morning, and later also removing all columns from the dbf. That did NOT do the trick.

I see that the attribue 'KATEGORI' in t2.shp does NOT show strange characters anymore (while the original did).

Anyway. I think QGIS should not crash, even not from corrupted data.

@jonas so a workaround would be to cleanup all your shapes....

qgib commented 10 years ago

Author Name: Jonas Ohlund (Jonas Ohlund)


I'm amazed with all your knowledge and grateful for your help. Internet is sure revolutionary in many ways!

@Giovanni: yes, running shortest path with the cleaned files you attached worked so it feels like I'm getting closer to actually being able to use QGIS instead of ArcGIS. Unfortunately I wasn't able to clean files myself using Grass v.clean and just like @Richards gutfeeling indicated, there seams to be some kind of mac/python problem since GRASS v.clean crashed as well. Any idea what I could be doing wrong? I just ran the v.clean on the same files I sent you without changing any settings in the toolbox.. (See attached crash log)

Like you said it seems to be data related, but the same files works fantastic with ArcGIS and this is the only data source I can use for the project so Im still stuck here with a ticking clock. I haven't really understood what it takes to get a developer to look at this and what the time perspective on solving this is? What can I do to speed it up?

Two more questions:

  1. Do you guys have any thoughts on the installation process in OS X? Do you think I would get better stability if I installed the whole Xcode package (getting python and all the dependencies right)? Like I said I followed the instructions at Kyngchaos.com and got some errors, is there anything I could have missed there?
  2. Right now I'm still putting all my hopes in finding a solution with your help or at least find a way to make v.clean work like @Giovanni did. But plan B would be to explore if osgeo4w live cd could boot from USB? (I have an SSD drive in my OptiBay..) @Richard you wrote that I osgeo4w required Intel, my mac is intel based, could that work?

Again, thank you big time for your time and commitment!

Kindly, Jonas



qgib commented 10 years ago

Author Name: Jonas Ohlund (Jonas Ohlund)


@Richard Im pretty sure the data isnt corrupt. Same shapes works fine with ArcGIS at school. Could the "strange characters " be swedish letters åäö? But why shouldnt python be able to handle that?

Thanks again everone! All further help in solving this is much appricated! (See my last post with a new crash log)

/Jonas

qgib commented 10 years ago

Author Name: Giovanni Manghi (@gioman)


Jonas Ohlund wrote:

@Richard Im pretty sure the data isnt corrupt.

the data is not corrupt, but it can have geometry issues that are not handled correctly by the road graph tool (that is not python).

Same shapes works fine with ArcGIS at school.

it happens, and it happens also vice-versa. Now we have data that is not handled correctly by the tool we can open a detailed report and allow a dev fix it.

Thanks again everone! All further help in solving this is much appricated! (See my last post with a new crash log)

The workaround as already said is to give your data a pass with v.clean using the processing toolbox.

The python error you attached here shows when launching v.clean? do you have non ascii chars in the path of your input data?

qgib commented 10 years ago

Author Name: Giovanni Manghi (@gioman)


@Giovanni: yes, running shortest path with the cleaned files you attached worked so it feels like I'm getting closer to actually being able to use QGIS instead of ArcGIS. Unfortunately I wasn't able to clean files myself using Grass v.clean and just like

see the attached screenshot to see the options I used

Like you said it seems to be data related, but the same files works fantastic with ArcGIS

as I said in the other answers, it happens, but also happens the other way.

What can I do to speed it up?

hire a developer, make a contribution, study the code and submit a patch

Two more questions:

  1. Do you guys have any thoughts on the installation process in OS X?

sorry, I don't do Apple.

  1. Right now I'm still putting all my hopes in finding a solution with your help or at least find a way to make v.clean work like @Giovanni did. But plan B would be to explore if osgeo4w live cd could boot from USB? (I have an SSD drive in my OptiBay..) @Richard you wrote that I osgeo4w required Intel, my mac is intel based, could that work?

The faster way to have a working copy of QGIS in another platform is using a Linux Virtual Machine or a live cd/usb.



qgib commented 10 years ago

Author Name: Matthias Kuhn (@m-kuhn)


Jonas, I just had a look at your latest log (v_clean)

I hope you are not afraid of a short test involving the edit of a source file.

If you could open the file @/Users/Jonas/.qgis2/python/plugins/processing/outputs/Output.py@ and replace any occurrence of @str(@ with @unicode(@ and see if that solves the issue or just part of it, we could probably create a fix for this (secondary) issue.

qgib commented 10 years ago

Author Name: Jonas Ohlund (Jonas Ohlund)


v.clean now works after using Giovanni's settings (I used break instead of snap before) and moving the data out of a directory containing the letter "ä". So I now have a working work-around.

Im now officially using QGIS for this project thanks to you guys!

I'm setting the status to 50% done but leaving the tread open so that issues like this can be sorted out making QGIS a competitive alternative to ArcGIS for "normal" users not prepared to go through a weekend of troubleshooting including (mailinglists, forums, and even mIRC to find a solution)

Thanks again everybody!

Kindly, Jonas Öhlund


qgib commented 10 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 10 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 10 years ago

Author Name: Matthias Kuhn (@m-kuhn)


Fixed in changeset "758f5e5df9b31f9586af24f152a4dfefba1784ef".


qgib commented 10 years ago

Author Name: Matthias Kuhn (@m-kuhn)


Reasoning: 2.5D layers are not supported by the plugin, but still available as source layers in the settings. This fix makes them unavailable (and inserts an additional security check) for routing so basically fixing the crash.

For now please use a tool which flattens the layer to 2D (like v.clean) to work with it.

Richard opened the feature request #17809 for 2.5D input layer support.