#895 closed patch (invalid)
[raster]: FV.01 functions
Reported by: | dustymugs | Owned by: | dustymugs |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS Fund Me |
Component: | raster | Version: | master |
Keywords: | Cc: | jorge.arevalo@… |
Description
Well, I believe I've completed the functions for FV.01. The following functions have been added:
ST_Band(rast raster, bandnums int[])
ST_AsGDALRaster(rast raster, format text, options text[], srs text)
ST_AsTiff(rast raster, options text[], srs text)
ST_AsPNG(rast raster, options text[], srs text)
ST_AsJPEG(rast raster, options text[], srs text)
Each of the above have several variations.
I've also added two ancillary function:
ST_getGDALDrivers()
for getting available and usable GDAL drivers on the server
ST_srtext(rast raster)
A bunch of the functions needed to get a spatial reference's srtext/proj4text to pass to the GDAL raster, so this function was written.
I've added test cases to both test/core and test/regress though I think the test cases could be built upon.
As my C skills were definitely rusty when I started this, please feel free to correct my errors and more importantly, let me know what they are. I will admit, the code was easy to understand and well documented!
Oh, I did make one tweak to raster/scripts/python/Makefile.in to accept the variable DESTDIR for when building packages.
-bborie
Attachments (1)
Change History (14)
comment:1 by , 14 years ago
Component: | postgis → postgis raster |
---|---|
Owner: | changed from | to
Summary: | FV.01 functions → [raster]: FV.01 functions |
comment:2 by , 14 years ago
follow-up: 4 comment:3 by , 14 years ago
Some questions:
-Would it not be more useful to provide PostGIS users with flexible but more user friendly parameters for Tiff, JPEG, and PNG so that we don't have to copy or refer to the GDAL doc? It would be our job to wrap those to the option strings provided to _st_asgdalraster(). We could provide both the wrapped ones and the generic ones (in case our wrapped one are not yet aligned to GDAL or we do not provide a very specific option).
-How will 1, 2, 4 or more band rasters be converted to JPEG and/or PNG?
-What is the use of the "srs text" parameter?
comment:4 by , 14 years ago
Replying to pracine:
Some questions:
-Would it not be more useful to provide PostGIS users with flexible but more user friendly parameters for Tiff, JPEG, and PNG so that we don't have to copy or refer to the GDAL doc? It would be our job to wrap those to the option strings provided to _st_asgdalraster(). We could provide both the wrapped ones and the generic ones (in case our wrapped one are not yet aligned to GDAL or we do not provide a very specific option).
Yes, you are correct. I plan on writing the appropriate ST_AsPNG, ST_AsJPEG and ST_AsTIFF variations today and over the weekend. Most of the ones I've written thus far are generic and meant to provide a raw interface.
-How will 1, 2, 4 or more band rasters be converted to JPEG and/or PNG?
I know that 1 and 3 band rasters work fine. I'm thinking of raising a notice for rasters with 2, 4 or more bands and only using the first band.
-What is the use of the "srs text" parameter?
I couldn't find a way to get the srtext (or proj4text if srtext isn't available) in rt_pg.c for a raster's srid to embed as the GDAL raster's srs. GeoTIFF does support this while PNG and JPEG do not. If there is a correct way to get the srtext from rt_pg.c, please let me know.
comment:5 by , 14 years ago
It would also probably nice and more standard with other functions to have some variants enabling to specify the band to convert directly in the functions instead of having to use ST_Band():
ST_AsTiff(rast raster, bands[], options text[], srs text)
But it's nice to have ST_Band() as well.
comment:7 by , 14 years ago
I'd like some feedback on the TIFF, PNG, and JPEG ST_AsXXX functions. I've already implemented the most generic functions but and particularly interested in opinions regarding the "compression" and "bands" arguments.
Are there any other function parameters that should be considered?
-- ST_AsTIFF ST_AsTIFF(rast raster) ST_AsTIFF(rast raster, options text[]) ST_AsTIFF(rast raster, options text[], srs text) ST_AsTIFF(rast raster, bands int[]) ST_AsTIFF(rast raster, bands int[], options text[]) ST_AsTIFF(rast raster, bands int[], options text[], srs text) ST_AsTIFF(rast raster, compression text) /* e.g. DEFLATE9 or JPEG75 */ ST_AsTIFF(rast raster, compression text, srs text) ST_AsTIFF(rast raster, bands int[], compression text) ST_AsTIFF(rast raster, bands int[], compression text, srs text) -- ST_AsJPEG ST_AsJPEG(rast raster) ST_AsJPEG(rast raster, options text[]) ST_AsJPEG(rast raster, bands int[]) ST_AsJPEG(rast raster, bands int[], options text[]) ST_AsJPEG(rast raster, compression int) ST_AsJPEG(rast raster, bands int[], compression int) -- ST_AsPNG ST_AsPNG(rast raster) ST_AsPNG(rast raster, options text[]) ST_AsPNG(rast raster, bands int[]) ST_AsPNG(rast raster, bands int[], options text[]) ST_AsPNG(rast raster, compression int) ST_AsPNG(rast raster, bands int[], compression int)
comment:8 by , 14 years ago
In the latest patch, I've dramatically expanded on the ST_AsTIFF, ST_AsJPEG and ST_AsPNG functions. I've created functions for:
-- ST_AsTIFF ST_AsTIFF(rast raster) ST_AsTIFF(rast raster, options text[]) ST_AsTIFF(rast raster, options text[], srs text) ST_AsTIFF(rast raster, bands int[]) ST_AsTIFF(rast raster, bands int[], options text[]) ST_AsTIFF(rast raster, bands int[], options text[], srs text) ST_AsTIFF(rast raster, compression text) ST_AsTIFF(rast raster, compression text, options text[]) ST_AsTIFF(rast raster, compression text, options text[], srs text) ST_AsTIFF(rast raster, bands int[], compression text) ST_AsTIFF(rast raster, bands int[], compression text, options text[]) ST_AsTIFF(rast raster, bands int[], compression text, options text[], srs text) -- ST_AsJPEG ST_AsJPEG(rast raster) ST_AsJPEG(rast raster, options text[]) ST_AsJPEG(rast raster, bands int[]) ST_AsJPEG(rast raster, bands int[], options text[]) ST_AsJPEG(rast raster, compression int) ST_AsJPEG(rast raster, compression int, options text[]) ST_AsJPEG(rast raster, bands int[], compression int) ST_AsJPEG(rast raster, bands int[], compression int, options text[]) -- ST_AsPNG ST_AsPNG(rast raster) ST_AsPNG(rast raster, options text[]) ST_AsPNG(rast raster, bands int[]) ST_AsPNG(rast raster, bands int[], options text[]) ST_AsPNG(rast raster, compression int) ST_AsPNG(rast raster, compression int, options text[]) ST_AsPNG(rast raster, bands int[], compression int) ST_AsPNG(rast raster, bands int[], compression int, options text[])
by , 14 years ago
Attachment: | FV.01.patch added |
---|
comment:9 by , 14 years ago
Owner: | changed from | to
---|
comment:10 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
The functions comprised in FV.01 has been processed in individual tickets for each key function. As such, this ticket is closed.
comment:11 by , 14 years ago
comment:12 by , 13 years ago
Milestone: | PostGIS Raster Future → PostGIS Future |
---|
I need to do some more work on ST_AsJPEG and ST_AsPNG to add more checks due to various format limitations and add a method to specify band numbers. Hopefully, I'll have the changes done on Friday.