Bug report #2430

Random points ftools issue

Added by dr - over 10 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Low
Assignee:cfarmer -
Category:Python plugins
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:12490

Description

1. Open shapefile: 2. Try to put two random points with Random points tool;[[BR
]
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)]

randomPoint__2430_comment_3.diff Magnifier - patch to fix the error reported in the 3rd comment (824 Bytes) Giuseppe Sucameli, 2010-06-30 03:24 PM

Associated revisions

Revision 13cf72af
Added by cfarmer - almost 10 years ago

fixes #2430 and speeds up random point generation on top of vectors significantly

git-svn-id: http://svn.osgeo.org/qgis/trunk/[email protected] c8812cc2-4d05-0410-92ff-de0c093fc19c

Revision 6f3384df
Added by cfarmer - almost 10 years ago

fixes #2430 and speeds up random point generation on top of vectors significantly

git-svn-id: http://svn.osgeo.org/qgis/[email protected] c8812cc2-4d05-0410-92ff-de0c093fc19c

History

#1 Updated by Giovanni Manghi over 10 years ago

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.

#2 Updated by Maxim Dubinin over 10 years ago

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

#3 Updated by Paolo Cavallini about 10 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()r0
UnboundLocalError: local variable 'index' referenced before assignment

Versione Python:
2.6.5 (0f397015 (SVN r266):79063, Mar 18 2010, 23:59:47)
[GCC 4.4.3]

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

#4 Updated by Paolo Cavallini about 10 years ago

See also #2495 (partial duplicate).

#5 Updated by Giuseppe Sucameli almost 10 years ago

Replying to [comment:3 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()r0
UnboundLocalError: local variable 'index' referenced before assignment

Versione Python:
2.6.5 (0f397015 (SVN r266):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.

#6 Updated by cfarmer - almost 10 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

fixed in 6f3384df (SVN r13861) and 9c2efef7 (SVN r13862)

Carson

Also available in: Atom PDF