Open nicogodet opened 4 months ago
Can you try with native:geometrybyexpression
?
@lbartoletti Yup that works
processing.run(
"native:geometrybyexpression",
{'INPUT':'C:/Users/godet/AppData/Local/Temp/processing_XEbwJc/a62d9d34df06403fa7fecb7207b5ad68/dropmzvalues.shp',
'OUTPUT_GEOMETRY':2,
'WITH_Z':True,
'WITH_M':False,
'EXPRESSION':'make_point(x($geometry), y($geometry), "Z")',
'OUTPUT':'TEMPORARY_OUTPUT'}
)
But the bug remains in native:translategeometry
as it is supposed to create a 3D geometry if deltaZ != 0.
https://github.com/qgis/QGIS/blob/a738296d6c79fddcbf450a2ed5c82bba52753e58/src/analysis/processing/qgsalgorithmtranslate.cpp#L159-L160
But the bug remains in
native:translategeometry
as it is supposed to create a 3D geometry if deltaZ != 0.
Yes, but I think you should have a 3D geometry in input.
I tested with a 2D Point (memory layer) and a stupid expression ($y - 40) and it's ok for me.
Input: Point (6.63495238951347677 45.9354297419651445)
Output: PointZ (6.63495238951347677 45.9354297419651445 5.9354297419651445)
Can you try with
native:geometrybyexpression
?
And you can also try native:setzvalue
I tested with a 2D Point (memory layer) and a stupid expression ($y - 40) and it's ok for me.
Input: Point (6.63495238951347677 45.9354297419651445) Output: PointZ (6.63495238951347677 45.9354297419651445 5.9354297419651445)
If you output to a file (not a TEMPORARY_OUTPUT), the Z value disappear
And you can also try
native:setzvalue
How could I miss this one... Works fine of course.
If you output to a file (not a TEMPORARY_OUTPUT), the Z value disappear
Can you try with a GPKG please?
with @florentfgrs we have encountered strange behavior with processing and Z
Same
I've tested using QGIS 3.35 with the provide layer and steps, and I can confirm the described behaviour.
It looks like the QgsTranslateAlgorithm::outputWkbType function only takes in consideration the value of the DELTA_Z fixed parameter (mDeltaZ
) and not also the calculated value of the data defined override expression.
Anyway, what will be the output wkb when an input layer has some features with the calculated (via data defined override) DELTA_Z = 0 and other ones with the calculated (via data defined override) DELTA_Z <> 0? Maybe QgsTranslateAlgorithm::outputWkbType should always add Z and/or M to the wkb when the data defined override is set for the DELTA_Z and/or the DELTA_M regardless of the actual calculated value of the data defined override expression.
What is the bug or the crash?
I try to create a PointZ vector from Point with Z attribute. For this I use
native:translategeometry
(maybe it's not the best way, if so, guide me 😃).Sample data for test : Point with Z attr.zip
Steps to reproduce the issue
Execute
native:translategeometry
with provided data and set "Z" field as deltaZ data defined value. See, it creates a Point layerSet a constant value for deltaZ
Versions
3.34.3
Supported QGIS version
New profile
Additional context
No response