Open nicolas-f opened 9 years ago
ST_ImageFromRaster must detect the format suffix no ?
The format of Raster is WKB Raster. This function must translate into another format, defined by the user.
So this functions is used to convert ?
Yes this is the inverse of ST_RasterFromImage. So you should call something like that:
SELECT ST_ImageFromRaster(ST_RASTERFROMIMAGE(FILE_READ('/home/user/aerial.png'), 150, 200, 1, 1, 0, 0, 4326), 'bmp') bmpData;
Perfect
Added ImageIO drivers
Added ST_ImageFromRaster
Maybe implement FILE_WRITE( lob, String ), to write image obtained through ImageFromRaster ?
Yes you are right
Add ST_MakeEmptyRaster
Raster.toString() is converted into human readable metadata:
w:10 h:10 bands:3 srid:27572 x:0.00000 y:0.00000 scalex:1.00000 scaley:-1.00000 skewx:0.00000 skewy:0.00000
@nicolas-f Maybe its more clear to write ST_MakeEmptyRaster ?
ok..
Add ST_BandMetaData
Currently WKB Image parsing is slow because there is absolutely no pixel cache. Here a sample of what is done currently:
I want RGB of pixel 500 red = Blob.getInputStream().skip(adressOfRedBandPixelZero) green = stream.skip(adressOfGreenPixelZero) blue = stream.skip(adressOfBluePixelZero)
I want RGB of Pixel 501 The problem here is the stream is in the blue band area. We have to reopen the stream and skip to the red band for pixel 501.
The class WKBRasterDataBuffer should cache the bands values for a row. The goal is to reset the minimum of times the stream and reduce the seek amount.
Add ST_WorldToRasterCoord ST_WorldToRasterCoordX ST_WorldToRasterCoordY
To be consistent with geometry drivers, ST_RasterFromFile function will be renamed by ST_WorldFileImageRead (eg SHPRead) and a new function ST_WorldFileImageWrite will be added.
Note : I don't want to use raster because it's a type (a category of datatype) and not a format like worldfile, geotiff.
what about ST_RasterFromWorldFile ?
No because we must also write st_geometryfromfile ;-)
ST_WorldFileImageWrite will have the following signature
ST_WorldFileImageWrite(RASTER, '/tmp/toto.png')
Usages
SELECT ST_WorldFileImageWrite(the_raster, '/tmp/toto.png') from myRasterTable limit 1;
SELECT ST_WorldFileImageWrite(the_raster,concat( concat( '/tmp/toto_', pkValue), '.png')) from myRasterTable;
@nico any input about this feature ? We are looking forward using raster in H2GIS ;-)
Note : The TIFF format will be integrated in JAVA 9 http://openjdk.java.net/jeps/262
Nice.
@gpetit I've merged the raster branch with the last h2 update. I have to write documentation and then create a pull request to h2 database.
+1 We can help you to write the documentation.
The branch is here https://github.com/nicolas-f/h2database/tree/georaster_patch
Off db raster is still not supported yet. But band metadata can already store the path of the external image.
Add a unit test ? SELECT FILE_WRITE(ST_IMAGEFROMRASTER(data, 'png'), '/tmp/test.png') FROM test @nicolas-f
Test done