Skip to Content

Répondre au commentaire

the point has no z coordinate

hi,
I tried to reproduce your code in my plugin for qgis:

in windows I always get this error:
"The point has no z coordinates"

this is my code:

on_tre_d_pressed def(self):
# layer.select ([])
# layer.setSelectedFeatures ([obj.id () for obj in layer])
# tre_d =''
mylayer = self.iface.activeLayer()
# tre_d (mylayer)
if self.tab_5.text() == "":
tab_5 = 0
else:
tab_5 = int(self.tab_5.text())

import loads from shapely.wkb

x = []
y = []
z = []
for elem in mylayer.selectedFeatures ():

geom = elem.geometry()
wkb = geom.asWkb()
data = loads(wkb)
x.append(data.x)
y.append(data.y)
z.append(data.z)

x = []
y = []
z = []
for elem in mylayer.selectedFeatures ():
geom = elem.geometry()
x.append(geom.asPoint()[0])
y.append(geom.asPoint()[1])
tab = "(z.append (elem.attributeMap()[%d].toFloat()[0]))"% int (self.tab_5.text())
eval(tab)

in the python console the error is intercepted near "z.append (data.z)"

Do you know why?
any idea?

thanks

Répondre

Le contenu de ce champ sera maintenu privé et ne sera pas affiché publiquement.