Hello,

I've been trying to figure out how to draw grids and lines from numpy
arrays without driving to a raster/vector file first.  I tried using the
gdal 'MEM' driver to make a gdal Dataset from a numpy array and pass that
in as a QgsRasterLayer, I get the following:

>>> memobj
<osgeo.gdal.Dataset; proxy of <Swig Object of type 'GDALDatasetShadow *' at
0x0000019B3131AC30> >
>>> QgsRasterLayer(memobj, 'testlayer', 'gdal')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: QgsRasterLayer(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'Dataset'

The only other approach that I could find was:

https://gis.stackexchange.com/questions/201804/how-to-create-raster-layer-directly-from-numpy-array-in-qgis-without-saving-to

but I suspect that the return from the processing.run command is probably a
temp file, so it is still going to file.  Is there not a way to generate a
raster layer from a numpy array without writing to file first?

Thanks,
Eric

-- 
Eric Younkin
Physical Scientist
NOAA OCS, Hydrographic Systems and Technology Branch
1315 East-West Highway
N/CS11, Room 6604
Silver Spring, MD 20910
Office: 240-847-8208
Cell: 828-331-8197
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to