Bug report #9423

QgsGeometry.asMultiPoint() returns wrong values

Added by Minoru Akagi over 10 years ago. Updated over 10 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Vectors
Affected QGIS version:2.0.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:18017

Description

Tested with this code:

>>> geom = QgsGeometry.fromWkt("MULTIPOINT (10 30, 40 20, 30 10, 20 10)")
>>> geom.isMultipart()
True
>>> geom.wkbType()
4
>>> geom.exportToWkt()
u'MULTIPOINT(10 30, 40 20, 30 10, 20 10)'
>>> geom.asMultiPoint()
[(2.07681e-317,2.13236e-314), (7.8611e-304,0), (3.25372e-319,3.48771e-310), (4.27265e-306,0)]

Got wrong values!

In cases of other types, the function returns expected values:

>>> QgsGeometry.fromWkt("POINT (10 30)").asPoint()
(10,30)
>>> QgsGeometry.fromWkt("LINESTRING (10 10, 20 10, 30 10)").asPolyline()
[(10,10), (20,10), (30,10)]
>>> QgsGeometry.fromWkt("MULTILINESTRING ((10 10, 20 10, 30 10), (10 30, 20 20, 30 10))").asMultiPolyline()
[[(10,10), (20,10), (30,10)], [(10,30), (20,20), (30,10)]]
>>> QgsGeometry.fromWkt("POLYGON ((10 10, 20 10, 20 20,10 10))").asPolygon()
[[(10,10), (20,10), (20,20), (10,10)]]
>>> QgsGeometry.fromWkt("MULTIPOLYGON (((10 10, 20 10, 20 20,10 10)), ((20 20, 30 20, 30 30,20 20)))").asMultiPolygon()
[[[(10,10), (20,10), (20,20), (10,10)]], [[(20,20), (30,20), (30,30), (20,20)]]]

With 1.8, returns expected values:

>>> QgsGeometry.fromWkt("MULTIPOINT (10 30, 40 20, 30 10, 20 10)").asMultiPoint()
[(10,30), (40,20), (30,10), (20,10)]

So this is a regression.

Associated revisions

Revision 781e34a5
Added by Jürgen Fischer over 10 years ago

fix QgsGeometry::asMultiPoint() (followup 6bbd17c2; fixes #9423)

History

#1 Updated by Minoru Akagi over 10 years ago

QGIS 2.0.1 also returns correct values. I get wrong results with master version (eaf5725).

#2 Updated by Jürgen Fischer over 10 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF