Opened 14 years ago

Closed 14 years ago

#2430 closed bug (fixed)

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
Must Fix for Release: No Platform: All
Platform Version: 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 (1)

randomPoint #2430 comment 3.diff (824 bytes ) - added by brushtyler 14 years ago.
patch to fix the error reported in the 3rd comment

Download all attachments as: .zip

Change History (7)

comment:1 by lutra, 14 years ago

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.

comment:2 by gislab, 14 years ago

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

comment:3 by pcav, 14 years ago

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.

comment:4 by pcav, 14 years ago

See also #2495 (partial duplicate).

in reply to:  3 comment:5 by brushtyler, 14 years ago

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.

by brushtyler, 14 years ago

patch to fix the error reported in the 3rd comment

comment:6 by cfarmer, 14 years ago

Resolution: fixed
Status: newclosed

fixed in r13860 and r13861

Carson

Note: See TracTickets for help on using tickets.