[postgis-users] GeomFromWKB (was: Problem with PostGIS 1.0.0 RC1)

strk at refractions.net strk at refractions.net
Mon Jan 24 01:47:34 PST 2005

On Sun, Jan 23, 2005 at 10:25:52AM -0800, David Blasby wrote:
> > RETURNS geometry as
> > 'select geomFromWKB($1::geometry::bytea)'
> Why are you running the conversion twice (WKB->GEOMETRY->WKB->GEOMETRY)?
>  RETURNS geometry as
>  'select ($1::geometry)'

Ok. Let's better define the problem.

GeomFromWKB is an OGC function, and we worked to make this clear
for the user. For example, if you give GeomFromWKB a WKB defining
3D geometry you'll get a Warning. Similarly if you use the M or
SRID extension you still get a Warning.

This is what OGC says about it:

The GeomFromWKB function, takes a well-known binary representation of geometry
(WKBGeometry as described in section 3.3) and a Spatial Reference System ID
(SRID) and creates an instance of the appropriate geometry type.
This function plays the role of the Geometry Factory in SQL.
An implementation shall substitute an SQL type used to represent binary
values for the type Binary in the definitions below.

  GeomFromWKB(WKBGeometry Binary, SRID Integer)

Construct a Geometry value given its well-known binary representation.

For PostgreSQL the implementation shall substitute 'bytea' to 'Binary',
and this is what is done within RC1.

So, for *strictness* we should force users to use bytea (porting to
this behaviour also all of GeomTypeFromWKB - currently cheating).

For *portability* we might want to be broader in what we accept, but
should still warn about it.

My question: is taking HEXWKB really a portability issue ?
Where did user take that GeomFromWKB(HEXWKB) call from ?


More information about the postgis-users mailing list