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

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Thu Jul 30 09:49:34 PDT 2009


Mateusz Loskot wrote:

> 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?

IIRC the original PostGIS binary send/receive functions used HEXEWKB 
rather than bytea which is probably why the ST_bytea function is there 
(in fact, I didn't really notice it was there until you mentioned it!). 
So in short, ST_bytea is deprecated and really shouldn't be used - just 
stick with the ST_AsBinary()-type API and I don't think you can go far 
wrong.


HTH,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063



More information about the postgis-devel mailing list