Re: [gdal-dev] Java-GDAL binding:How to convert gdal dataset to byte array

2023-04-13 Thread Laurențiu Nicola via gdal-dev
Hi, VSIUnlink is https://gdal.org/java/org/gdal/gdal/gdal.html#Unlink(java.lang.String), but I can't find VSIGetMemFileBuffer or VSIFOpenEx2L and VSIFReadL, which you could use instead. FileFromMemBuffer is there, but it goes in the wrong direction. So sorry, I have no idea. I've never used th

Re: [gdal-dev] Java-GDAL binding:How to convert gdal dataset to byte array

2023-04-13 Thread Laurențiu Nicola via gdal-dev
Hi, I don't think ReadAsArray is the API you're looking for. If you do that, you'll end up with a buffer of pixel values, not with a proper TIFF or PNG tile. Instead, you can either use the MEM driver or the /vsimem/ prefix (like in https://gdal.org/api/cpl.html#_CPPv424VSIInstallMemFileHandler

[gdal-dev] Java-GDAL binding:How to convert gdal dataset to byte array

2023-04-12 Thread George Ma
Hello everyone. I have a trouble about java-gdal when I process raster geotif data. I want to convert Dataset type object to Byte array in order to return HttpResponse. But I dont know how to convert. If I write file on disk firstly,then I read the file into FileInputStream,I can convert to byte[],