Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #8

Closed
hoge6b01 opened this issue May 15, 2017 · 8 comments
Closed

IndexError: list index out of range #8

hoge6b01 opened this issue May 15, 2017 · 8 comments

Comments

@hoge6b01
Copy link

Hi,
performing an accessibility calculation I always get a python error. It happens if I use the 'Map now!' (with a sligthly different error msg) and when using a point layer.

As the error's result one gets a broken dissolve layer with one entry only.

If you need further clearification please let me know.
BR

`Ein Fehler trat bei der Ausführung von Python-Code auf:

IndexError: list index out of range
Traceback (most recent call last):
File "C:/Users/USERNAME/.qgis2/python/plugins\OSMtools\osm_tools_access.py", line 243, in pointAnalysis
self.dissolveFields(layer_out, fields_diss)
File "C:/Users/USERNAME/.qgis2/python/plugins\OSMtools\osm_tools_access.py", line 308, in dissolveFields
layer_dissolved = QgsMapLayerRegistry.instance().mapLayersByName("Dissolved")[-1]
IndexError: list index out of range

Python-Version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
QGIS-Version: 2.18.6 Las Palmas, 5f369b0 `

@nilsnolde
Copy link
Contributor

Hi,
in both cases (button and layer) you have 'Use Layer' and 'Dissolve Output' checked?

I´ll try to reproduce later, API seems to down right now..

Cheers
Nils

@nilsnolde
Copy link
Contributor

Sorry, can´t reproduce here, no matter how I do it.

If you run the 'Dissolve' tool on a random layer, what is the the output layer called? Might be, that this is a language specific thing. I´m looking for layers called 'Dissolved' and rename them. If your language pack calls it smth else, this could crash.

Cheers
Nils

@hoge6b01
Copy link
Author

Well, I changed language to english and tried it again. Same error.
If I use QGIS' Dissolve tool it names the layer 'Dissolved'.

So what I did:
I created a point layer (EPSG 4326) and calculated areas (max 15 min; intervals 5 min). Result is a layer ''AA_driving-car" and there are three areas for each location - correct. The resulting layer for the dissolve called "memory:dissolved" only contains the dissolved areas for the 15 min drive-time. 5 min and 10 min are missing. It even creates a "memory:dissolve" layer when "dissolve output" is not activated.

I am not a programmer but I am asking myself if '-1' is a valid list index:
layer_dissolved = QgsMapLayerRegistry.instance().mapLayersByName("Dissolved")[-1] IndexError: list index out of range

What else can I provide to get this problem solved?

@nilsnolde
Copy link
Contributor

Hi,

no worries, '-1' is used to index the last element in a list, it´s entirely fine.

Let me talk to the ORS guys, I think, the 'Dissolve' feature is obsolete anyways. Before the revamp of the API, the accessibility areas were Multipolygons with lots of holes, now they seem to be very consistently single polygons. But I need to confirm this before taking it out.

Will keep you posted
Nils

@nilsnolde
Copy link
Contributor

Looks like the 'dissolve' option can be removed:
link to google groups

And you´re right, dissolve happens in any case as of now. Honestly, I can´t remember why I put it in as (fake) optional. The code will apparently always dissolve the polygons on the "AA_Mins" field. Since this is now obsolete, I´ll remove those lines and post a new version sometime this week.

It´s still weird that your installation does something mine doesn´t, but unless we do a Teamviewer session, this is hard to resolve. Let´s see what happens after I fixed it.

@hoge6b01
Copy link
Author

Okay, I tried it on a clean install on different computer. I experienced no problems with that install. Guess the other installation of QGIS is just broken.
Thanks for having a deeper look into the programm.
Sorry for bothering. And thanks also for your information about the dissolve option.
BR

@larmort larmort mentioned this issue May 21, 2017
@nilsnolde
Copy link
Contributor

Hi,
for anyone still experiencing this issue, here is a new build with the 'dissolve' option removed:
osm_tools_v0.2_GUIscrollbar_Nodi

@hoge6b01
Copy link
Author

Perfect. No error anymore. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants