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

Polylines with NaN as Z values do not display properly since QGIS 3.26.1 #50510

Closed
2 tasks
olivierdalang opened this issue Oct 11, 2022 · 4 comments · Fixed by #50549
Closed
2 tasks

Polylines with NaN as Z values do not display properly since QGIS 3.26.1 #50510

olivierdalang opened this issue Oct 11, 2022 · 4 comments · Fixed by #50549
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Regression Something which used to work, but doesn't anymore

Comments

@olivierdalang
Copy link
Contributor

olivierdalang commented Oct 11, 2022

What is the bug or the crash?

Polylines with some points with NaN as Z values do not display properly.

The issue happens since QGIS 3.26.1, and seems to be a regression (tested on QGIS 3.22.11-Białowieża where it works as expected, and got reports that it also works as expected on 3.24).

Steps to reproduce the issue

  1. Run the following code in the Python console:
polyline = QgsGeometry.fromPolyline([
    QgsPoint(10,10,0),
    QgsPoint(20,20,0),
    QgsPoint(30,10, float("nan")),
])
vl = QgsVectorLayer("LinestringZ", "temporary_points", "memory")
vl.startEditing()
f = QgsFeature()
f.setGeometry(polyline)
vl.dataProvider().addFeatures([f])
vl.commitChanges()
QgsProject.instance().addMapLayer(vl)
  1. See incomplete feature on the map (misses the second segment)

image

Versions

QGIS version
3.26.3-Buenos Aires
QGIS code revision
65e4edf
Qt version
5.15.3
Python version
3.9.5
Compiled against GDAL/OGR
3.5.1
Running against GDAL/OGR
3.5.2
PROJ version
9.1.0
EPSG Registry database version
v10.074 (2022-08-01)
GEOS version
3.10.3-CAPI-1.16.1
SQLite version
3.38.1
PDAL version
2.4.3
PostgreSQL client version
unknown
SpatiaLite version
5.0.1
QWT version
6.1.6
QScintilla2 version
2.13.1
OS version
Windows 10 Version 2009

Active Python plugins
plugin_reloader
0.7.9
qfieldsync
v4.1.1
QgisModelBaker
v7.0.3
qgepplugin
1.0.0
swiss_locator
2.0.2
tiautoigdplugin
dev
db_manager
0.1.20
grassprovider
2.12.99
MetaSearch
0.3.6
processing
2.12.99
sagaprovider
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@olivierdalang olivierdalang added Regression Something which used to work, but doesn't anymore Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Oct 11, 2022
@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Oct 11, 2022

I can confirm this issue with QGIS 3.26.0, too.
This very issue is also the root cause of the issue reported at #49310.

@lbartoletti
Copy link
Member

polyline = QgsGeometry.fromPolyline([
    QgsPoint(10,10,0),
    QgsPoint(20,20,0),
    QgsPoint(30,10) # notice last point has no Z value
])

This behavior is incorrect (it's on my todo list since years, but don't know if it will break api/plugins). IMHO, It should raise an error or add Z value from the default value.

@olivierdalang
Copy link
Contributor Author

This behavior is incorrect (it's on my todo list since years, but don't know if it will break api/plugins). IMHO, It should raise an error or add Z value from the default value.

I'm not sure using a default here would be the right thing to do, but it's a different issue.... For this issue, it is wished to have a nan coordinate, not a default one. I updated the snipped to explicitly set it with nan.

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Oct 11, 2022

PolygonZ / MultiPolygonZ / PolygonZM / MultiPolygonZM with vertices having nan as the Z coordinate are also not correctly displayed by QGIS 3.26, while are correctly displayed by QGIS 3.24, 3.22 and previous versions.

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! Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants