[QGIS-Developer] PyQGIS info on MeshLayer

Richard Duivenvoorde rdmailings at duif.net
Tue Jan 24 00:40:21 PST 2023


Hi Devs,

I'm trying to get values from an x,y from a mesh layer via PyQGIS.

But I fail to SEE the results. Debugging in QtCreator, I see that there 
are results, but apparently they are dropped somewhere?

The code I'm using:

results = []   # iterator 'reference'?
context = QgsIdentifyContext()
context.setTemporalRange(QgsDateTimeRange(begin=QDateTime(2022,11,7,7,0,0),end=QDateTime(2022,11,7,8,0,0)))
# make sure the mesh layer is active layer
# note that the coordinates used are MapCanvas coordinates (???)
# returns QgsMapToolIdentify False in case of NO layer
print(QgsMapToolIdentify(iface.mapCanvas()).identifyMeshLayer(results, 
iface.mapCanvas().currentLayer(), QgsPointXY(470208.66, 6766348.44), 
context ))
print(results)

This always returns [] (empty list), while debugging c++ in QtCreator I 
see there are results.

Am I doing something wrong?

Thanks for any Pointers.

Regards,

Richard Duivenvoorde


More information about the QGIS-Developer mailing list