<div dir="ltr"><div>Hi Marco,<br><br></div>The new node editor widget does not suport Z value of 3d shapefiles, right?<br><div><br>Could Paulo's proposal be interesting to add to the node widget?<br><br></div><div>Thanks!<br></div><div>Pedro<br><br></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-26 14:15 GMT+01:00 Paulo Pires <span dir="ltr"><<a href="mailto:paulopires16@gmail.com" target="_blank">paulopires16@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, see my code, please. I intend to maintain Z value on shapefile, so:<br>
I write first on canvas... even I give the Z value, it will write Z = 0.0,<br>
ok...<br>
<br>
feat = QgsFeature()<br>
feat.setGeometry(QgsGeometry.fromWkt("LINESTRING (151620 319350 10, 151710<br>
319350 10)"))<br>
layerCanvas.dataProvider().addFeatures([feat])<br>
layerCanvas.commitChanges()<br>
self.iface.mapCanvas().refresh()<br>
<br>
So, for grab the Z value, I go to the shapefile and update Z...<br>
<br>
driver = ogr.GetDriverByName('ESRI Shapefile')<br>
dataSource = driver.Open(myfilepath, 1)<br>
layer = dataSource.GetLayer()<br>
<br>
oldGeom = ogr.CreateGeometryFromWkt("LINESTRING (151620 319350 0, 151710<br>
319350 0)")<br>
newGeom = ogr.CreateGeometryFromWkt("LINESTRING (151620 319350 10, 151710<br>
319350 10)")<br>
<br>
# write shapefile<br>
for feature in layer:<br>
if feature.GetGeometryRef() is not None:<br>
geom = feature.GetGeometryRef()<br>
<br>
if geom.Distance(oldGeom) <= 0.1:<br>
<br>
# delete oldGeom<br>
featureId = feature.GetFID()<br>
layer.DeleteFeature(featureId)<br>
<br>
# create newGeom<br>
feature.SetGeometry(newGeom)<br>
feature.SetFID(featureId)<br>
layer.CreateFeature(feature)<br>
<br>
feature.Destroy()<br>
<br>
msg = "+++++++++++++++"<br>
# refresh<br>
self.getShpData()<br>
self.iface.mapCanvas().refresh()<br>
break<br>
<br>
dataSource.Destroy()<br>
<br>
In canvas, I see the right Z :)<br>
But when I edit something, I lost that geometry...<br>
In point geometry, that's all ok, but in linestring, it disappears...<br>
Thanks<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/grab-Z-value-tp5226284.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/grab-Z-value-tp5226284.html</a><br>
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br></div>