Ticket #2430 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Random points ftools issue

Reported by: dr Owned by: cfarmer
Priority: major: does not work as expected Milestone: Version 1.5.0
Component: Python plugins and bindings Version: Trunk
Keywords: Random points,ftools Cc: dr, gislab, alexbruy
Platform Version: Platform: All
Must Fix for Release: No Awaiting user input: no

Description

1. Open shapefile:  http://gis-lab.info/data/vmap0/bounds-correct.7z;
2. Try to put two random points with Random points tool;
At result I get an error:

An error has occured while executing Python code:

Traceback (most recent call last):
  File "C:\OSGeo4W\apps\qgis-dev\python\plugins\fTools\tools\doRandPoints.py", line 123, in accept
    self.randomize(inLayer, outPath, minimum, design, value, self.progressBar)
  File "C:\OSGeo4W\apps\qgis-dev\python\plugins\fTools\tools\doRandPoints.py", line 209, in randomize
    else: bound = self.createSinglePolygon(inLayer, progressBar)
  File "C:\OSGeo4W\apps\qgis-dev\python\plugins\fTools\tools\doRandPoints.py", line 155, in createSinglePolygon
    geom = geom.combine(QgsGeometry( feat.geometry() ))
AttributeError: 'NoneType' object has no attribute 'combine'

Python version:
2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]

Attachments

randomPoint #2430 comment 3.diff Download (0.8 KB) - added by brushtyler 3 years ago.
patch to fix the error reported in the 3rd comment

Change History

  Changed 3 years ago by lutra

  • owner changed from borysiasty to cfarmer

I tested both under windows (xp) and linux and got no python errors, but the tool is way too slow: I waited something like 10 minutes just to see the progress bar arrive at 41% and then become apparently stuck.

  Changed 3 years ago by gislab

I confirm, mine stuck at 14% with 10 random points. No error though.

follow-up: ↓ 5   Changed 3 years ago by pcav

Got a different error:

Traceback (most recent call last): File "/usr/share/qgis/python/plugins/fTools/tools/doRandPoints.py", line 124, in accept self.randomize(inLayer, outPath, minimum, design, value) File "/usr/share/qgis/python/plugins/fTools/tools/doRandPoints.py", line 186, in randomize else: points = self.loopThruPolygons(inLayer, value, design) File "/usr/share/qgis/python/plugins/fTools/tools/doRandPoints.py", line 227, in loopThruPolygons value = sAtMap[index].toInt()[0] UnboundLocalError?: local variable 'index' referenced before assignment

Versione Python: 2.6.5 (r265:79063, Mar 18 2010, 23:59:47) [GCC 4.4.3]

Strangely enough, this does not happen with some PC, for unknown reasons.

  Changed 3 years ago by pcav

See also #2495 (partial duplicate).

in reply to: ↑ 3   Changed 3 years ago by brushtyler

Replying to pcav:

Got a different error: Traceback (most recent call last): File "/usr/share/qgis/python/plugins/fTools/tools/doRandPoints.py", line 124, in accept self.randomize(inLayer, outPath, minimum, design, value) File "/usr/share/qgis/python/plugins/fTools/tools/doRandPoints.py", line 186, in randomize else: points = self.loopThruPolygons(inLayer, value, design) File "/usr/share/qgis/python/plugins/fTools/tools/doRandPoints.py", line 227, in loopThruPolygons value = sAtMap[index].toInt()[0] UnboundLocalError?: local variable 'index' referenced before assignment Versione Python: 2.6.5 (r265:79063, Mar 18 2010, 23:59:47) [GCC 4.4.3] Strangely enough, this does not happen with some PC, for unknown reasons.

I've found the issue: the reason is the used language. I'm writing a patch.

Changed 3 years ago by brushtyler

patch to fix the error reported in the 3rd comment

  Changed 3 years ago by cfarmer

  • status changed from new to closed
  • resolution set to fixed

fixed in r13860 and r13861

Carson

Note: See TracTickets for help on using tickets.