[postgis-devel] [WKT Raster] Plan to add ST_AsBinary

Mateusz Loskot mateusz at loskot.net
Thu Jul 30 03:54:19 PDT 2009


Hi,

First, the announcement:
I'm planning to implement ST_AsBinary function to WKT Raster, so users 
who work with binary cursors can avoid (significant) overhead of 
encoding raster data to hex form and back.
The ST_AsBinary(rast) function has been planned [1] already (see 
RT_AsBinary, old name).

Obviously, I'll follow PostGIS best practice and try to get the solution 
aligned to PostGIS' ST_AsBinary in terms of syntax and semantic.

Second, I'd like to ask for a piece of advice.
Currently, we have ST_bytea function in WKT Raster which seems to 
provide most of the features I need for ST_AsBinary.
The missing ones are handling endianness.
I see that PostGIS still provides ST_bytea function for geometry.
However, I can't find it in the documentation [2]

What I'm looking for is what's the difference between ST_AsBinary and 
ST_bytea, in PostGIS. Both functions are based on WKBFromLWGEOM, so I 
assume they return object of exactly the same type. AFAIU, the 
difference is that ST_AsBinary enables users to choose endianness of 
output binary.
Am I right? Is that all or something is missing?

Third, current roadmap defines only one version of (R)ST_AsBinary:

RT_AsBinary(raster, compression)

I'm thinking about extending it two four versions:

Initially, implement non-compressing version of ST_AsBinary for WKT Raster:

ST_AsBinary( rast ) - this is equivalent to ST_bytea ST_AsBinary( rast, 
endianness )

The compressing one can be added later as it is planned:

ST_AsBinary( rast, compression ) - equivalent to st_bytea but with 
compression applied ST_AsBinary( rast, compression, endianness )

I would appreciate any comments and suggestions to this idea.


[1] http://trac.osgeo.org/postgis/wiki/WKTRaster/PlanningAndFunding
[2] http://postgis.refractions.net/documentation/manual-1.4/ch07.html

Best regards,
--
Mateusz Loskot
Senior Programmer, Cadcorp
http://www.cadcorp.com




More information about the postgis-devel mailing list