I am working with a shapefile in QGIS (point layer),and I am trying to loop over all the points, however some are apparently not having a valid geometry.
When I type layer.getFeature(1).geometry()
I get <QgsGeometry: null>
And therefore I cant use the .asPoint()
function
However when I loop through all features, then it dosen't show those with null geometry:
for feature in layer.getFeatures():
print(feature.geometry().asPoint())
So how come that there is not shown any null geometry when looping through all layers, but one of the first (actually all features show null geometry when using the single feature layer.getFeature(x)
command).
Is there any way to solve this problem?