Hello,
I'm new to ArcGIS, and would like to create a file geodatabase or self contained project by making queries to a postgres database that includes postGIS data.
So far, I have been able to create and load a template with some layer groups, populate the groups with query layers that each contain one geometry, and then save it all to a new project.
The part I'm stuck on is creating a raster layer. The raster data are stored as well known binary in our database, and I can get them into ArcGIS Pro as Blobs in a standalone table by making a query something like this:
SELECT ST_AsTIFF(ST_RastFromWKB(wkb_image), 'JPEG90') tiff_image FROM my_table
Then I tried passing the Blobs to MakeRasterLayer inside of a SearchCursor loop:
with arcpy.da.SearchCursor(table, ["tiff_image"]) as cursor:
print(f"\nrows:")
for row in cursor:
print(row[0])
arcpy.MakeRasterLayer_management(row[0], "RasterLayer")
But that didn't work.
The next thing I'm thinking is to save the images before any of the ArcPy function calls, then load them with MakeRasterLayer. The documentation makes it sound like that should work.
Is there a better way to do this with ArcPy?