[QGIS-Developer] PyQGIS info on MeshLayer

Richard Duivenvoorde rdmailings at duif.net
Tue Jan 24 00:41:23 PST 2023


Sorry, fiddling with webmail, thinking using an old mail (from you) to 
sent to the dev list...
But apparently not :-(
Regards,
Richard

On 2023-01-24 09:40, Richard Duivenvoorde wrote:
> 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