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

"Densify geomteries" crashes QGIS #15157

Closed
qgib opened this issue May 11, 2012 · 10 comments
Closed

"Densify geomteries" crashes QGIS #15157

qgib opened this issue May 11, 2012 · 10 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@qgib
Copy link
Contributor

qgib commented May 11, 2012

Author Name: Giovanni Manghi (@gioman)
Original Redmine Issue: 5577
Affected QGIS version: master
Redmine category:processing/qgis
Assignee: Alexander Bruy


On Ubuntu 64bit

gio@sibirica:~$ qgis
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_US]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_US]
Debug: OpenlayersLayer draw
Debug: page file: file:////home/gio/.qgis/python/plugins/openlayers/html/google_satellite.html
Debug: undefined[0]: TypeError: 'null' is not an object
Debug: extent: -798709.4330660001141950,4709909.2752386806532741 : -797664.5537049998529255,4710634.0523063195869327
Debug: center: -798186.993386, 4710271.663773
Debug: size: 1149, 797
Debug: logicalDpiX: 96
Debug: outputDpi: 96.000000
Debug: mapUnitsPerPixel: 0
Debug: olSize: 1149, 797
Debug: adjust viewport: 0.909382 -> 0.597164: 1749.735190 x 1213.697952
Debug: updating OpenLayers extent
Debug: undefined[0]: TypeError: 'null' is not an object
Debug: scale image: 1749 x 1213 -> 1149 x 797
Debug: OpenlayersLayer draw
Debug: extent: -798709.4330656065139920,4709909.2752385335043073 : -797664.5537053393200040,4710634.0523056639358401
Debug: center: -798186.993385, 4710271.663772
Debug: size: 1149, 797
Debug: logicalDpiX: 96
Debug: outputDpi: 96.000000
Debug: mapUnitsPerPixel: 0
Debug: olSize: 1149, 797
Debug: adjust viewport: 0.909382 -> 0.597164: 1749.735189 x 1213.697951
Debug: updating OpenLayers extent
Debug: scale image: 1749 x 1213 -> 1149 x 797
Warning: QObject::setParent: Cannot set parent, new parent is in a different thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x260028d
Warning: X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 150 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x260028e
qgis.bin: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

on windows it just gives a python error (see attached image and sample)


@qgib
Copy link
Contributor Author

qgib commented May 11, 2012

Author Name: Alexander Bruy (@alexbruy)


This is because attached layer contains MultiLineString geometry. It is odd that wkbType() for this layer returns 2 (WKBLineString) instead of 5 (WKBMultiLineString). So IMHO here we have two problems:

  1. wkbType() reports wrong layer geometry type
  2. densify geometries don't work with multi-geometries

I'll try to fix second ASAP

@qgib
Copy link
Contributor Author

qgib commented May 11, 2012

Author Name: Salvatore Larosa (@slarosa)


I don't think that the problem is the MultiGeometries:

$ ogrinfo /home/sam/Scaricati/caminhos_shp/caminhos.shp
INFO: Open of `/home/sam/Scaricati/caminhos_shp/caminhos.shp'
      using driver `ESRI Shapefile' successful.
1: caminhos (Line String)

indeed it is not a MultiLinestring!

@qgib
Copy link
Contributor Author

qgib commented May 11, 2012

Author Name: Giovanni Manghi (@gioman)


Alexander Bruy wrote:

This is because attached layer contains MultiLineString geometry. It is odd that wkbType() for this layer returns 2 (WKBLineString) instead of 5 (WKBMultiLineString). So IMHO here we have two problems:

wkbType() reports wrong layer geometry type

densify geometries don't work with multi-geometries

I'll try to fix second ASAP

Hi Alex,
this line shape was obtain in QGIS by digitizing a few features and doing a couple of "merge selected features" operations, so really nothing uncommon.

@qgib
Copy link
Contributor Author

qgib commented May 11, 2012

Author Name: Alexander Bruy (@alexbruy)


Salvatore Larosa wrote:

I don't think that the problem is the MultiGeometries:

[...]

indeed it is not a MultiLinestring!

Well, take a look at geometry with FID = 1. This one is MultiGeometry and you can easy check this in Python console

>>> layer = qgis.utils.iface.mapCanvas().currentLayer()
>>> ft = QgsFeature()
>>> layer.featureAtId(1, ft)
True
>>> ft.geometry().wkbType()
5

Giovanni Manghi wrote:

this line shape was obtain in QGIS by digitizing a few features and doing a couple of "merge selected features" operations, so really nothing uncommon.

Ah, so root of the problem is that "merge selected features" sometimes creates MultiGeometries (e.g. when there is a small distance between two features. Maybe when snapping is not used during digitizing, or something like this)

@qgib
Copy link
Contributor Author

qgib commented May 11, 2012

Author Name: Alexander Bruy (@alexbruy)


Anyway I add MultiLineString support in 033d58d, and now attached file processed correctly. Now working on MultiPolygon support

@qgib
Copy link
Contributor Author

qgib commented May 12, 2012

Author Name: Salvatore Larosa (@slarosa)


Alexander Bruy wrote:

Well, take a look at geometry with FID = 1. This one is MultiGeometry and you can easy check this in Python console
[...]

Right, thanks!
Anyway I noticed that imports shp in PostGIS, densify tool works succesfully this because the geometries are MultiLinestring!

I don't know why in QGIS (see image) and ogrinfo, it is consider like a LineString geometry type!!!


  • 4460 was configured as LinestringQGIS.png

@qgib
Copy link
Contributor Author

qgib commented May 12, 2012

Author Name: Salvatore Larosa (@slarosa)


Well,

FID 0,2,3 wkbType() returns 2 and isMultipart() returns False;
FID 1 wkbType() returns 5 and isMultipart() returns True.

Is it conceptually correct?

Now I begin to understand the issues #15140, #15029!
Could help Jürgen's fix(#14870)?

@qgib
Copy link
Contributor Author

qgib commented May 12, 2012

Author Name: Alexander Bruy (@alexbruy)


As I understand, shapefile can contain in LineString layer also MultiLineString geometries, and in MultiLineString layer simple LineString geometries (same for points and polygons). "Merge selected features" tool sometimes (when input features have some distance between them) produces multi-geometry. Modifying shapefile didn't change it type, so it continues to report old LineString type.

Multipolygon support added in 2607535, so I close this ticket. Please reopen if necessary


  • status_id was changed from Open to Closed
  • resolution was changed from to fixed

@qgib
Copy link
Contributor Author

qgib commented May 12, 2012

Author Name: Giovanni Manghi (@gioman)


Alexander Bruy wrote:

As I understand, shapefile can contain in LineString layer also MultiLineString geometries, and in MultiLineString layer simple LineString geometries (same for points and polygons). "Merge selected features" tool sometimes (when input features have some distance between them) produces multi-geometry. Modifying shapefile didn't change it type, so it continues to report old LineString type.

Multipolygon support added in 2607535, so I close this ticket. Please reopen if necessary

Hi Alex, thanks for this! I will give it a try asap!

@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms Crash/Data Corruption labels May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

1 participant