SrNetoChan / WalkingTime

QGIS Plugin to calculate walking time in line layers taking in account the terrain slope
6 stars 1 forks source link

Python Error while using WalkingTime #3

Open Jan050881 opened 10 years ago

Jan050881 commented 10 years ago

When i try to run the WalkingTime plugin a Python Error occurs after filling in the data and press the ok button. I'm not sure if this is a problem with the plugin or my Python console itself, but i hope someone has an idea. The error occurs even if i change layers, i tried it with different datasets, but no one works. Here is the error message:

Fehler bei der Ausführung von Python-Code:

Traceback (most recent call last): File "C:/Users/Jan/.qgis2/python/plugins\walkingtime\walkingtime.py", line 134, in run time, time_rev = self.timeCalc(geom) File "C:/Users/Jan/.qgis2/python/plugins\walkingtime\walkingtime.py", line 173, in timeCalc dh = elevation - last_elevation TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

Python-Version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

QGIS-Version: 2.2.0-Valmiera Valmiera, c3a2817

Thanks for your help! Jan

SrNetoChan commented 10 years ago

Hello Jan,

There are several things that my originate that error, I will try to sort them by what I think is most commom:

1 - Your line layer crosses some areas with no data or passes outside the elevation raster boundaries; 2 - Your line layer and raster layer are in different Coordinate Systems, hence it results in the first case, since the plugin does not work with on the fly transformation (yet); 3 - Your line layer have multipart features (it might not give you that error but can give you erroneous results); 4 - For last there might be some invalid geometries in the line layer features.

It's in my todo list solving problem 1 and 2. when I have the time.

So, has inputs you need that the layers are in the same Coordinate system, and that the line layer is fully contained on the elevation layer.

Try selecting only one feature that you are sure that meets the requirements and run the plugin with selected feature only options.

I hope this will helps you sorting the problem, and thar the plugin became useful.

Jan050881 commented 10 years ago

 

Thank you very much for your fast and helpful answer! I think the problem indeed was caused by multipart featured line layers. I now created some test layers with only one line on each and the plugin worked fine! So again thank you very much, now i know how to use WalkingTime and i think it will be very helpful for my analysis.

 Greetings from Germany Jan

cbertelli commented 10 years ago

Hello, I had the second problem and the error was due to a difference between the CRS of the paths and the DEM used. It could be useful to detect that difference and advise the user that he should use layers with the same CRS, but I think that asks almost the same time than the best solution, removing this limitation.

SrNetoChan commented 10 years ago

You are right, it should. Actually it's in my todo list https://github.com/SrNetoChan/WalkingTime/issues/2. Just have to get time for doing it.

henkth commented 9 years ago

Thank you for the WalkingTime plugin. Till date I have not been able to get it working. First I got the above listed Python problem, but after using the same CRS for project and layers, I am getting only 0.00 times for the columns time and rev_time. Would it be possible for you to send me a QGIS sample file that worked for you with some testing data so I can compare? Thanks!

SrNetoChan commented 9 years ago

I won't be able to do that in the next hours (if not days). Can you send me a sample of your data instead? I will give it a look.

henkth commented 9 years ago

Dear Alexandro,

Thank you very much for the offer to look at the data. Please find them included in a zip file with this mail. The area is around Leh in the Indian Himalaya, projected in WGS 84 / UTM zone 43N. I am using QGIS 2.8.2 on an iMac with OSX10.10.3

Best regards,

Henk Thoma

On 22 June 2015 at 13:52, Alexandre Neto notifications@github.com wrote:

I won't be able to do that in the next hours (if not days). Can you send me a sample of your data instead? I will give it a look.

— Reply to this email directly or view it on GitHub https://github.com/SrNetoChan/WalkingTime/issues/3#issuecomment-114037257 .

SrNetoChan commented 9 years ago

Can't see any attachement. Can you please send it to senhor.neto@gmail.com?

Thanks

SrNetoChan commented 9 years ago

Thank you for sending the sample. It did not work for me either. I will need some time to check/fix this.

kgeographer commented 6 years ago

Hello, I am having the problem of "TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'" reported above. I am using QGIS v3 and the ported plug-in. The raster is a GMTED2010 tiff grid. I have tried both native WGS84 and reprojected to EPSG:54002.

I also tried creating a degree slope surface from that and using it as the raster input, and it did compute costs. But I don't think those values are meaningful. Are there any answers to come of this thread from 2 years ago?

thanks

SrNetoChan commented 6 years ago

@kgeographer what is the EPSG of your line layer?

kgeographer commented 6 years ago

I think the CRSes of the two layers were not set properly; everything was 4326 natively, and some had only been reprojected on loading. I have tried now a few things and the result is no more errors, but I get only zero values computed for time and rev_time. I ensured both lines and DEM are the same projection (epsg:54030 - Robinson), set all 'no data' to 0.