Wednesday 18 September 2019

gdal - Downloading raster data into python from postgis using psycopg2


I have raster data in a postgres table that I want to get into python as a numpy array. I am using psycopg2 to connect to the db. I am able to download the data but it comes back as a string (probably a serialized binary).


Does any one know how to take this string and convert to a numpy array?


I explored other options to download the raster such as use st_astiff and encode to download the hex file and use xxd but that did not work. I keep on getting the error 'rt_raster_to_gdal: Could not load the output GDAL driver' and I don't have permissions to set the environment variables to be able to turn on the drivers.


TL, DR: want to import raster data into a numpy array (using python).




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...