[postgis-users] plpgsql build BOX3D

Markus Schaber schabi at logix-tt.com
Thu Nov 3 01:30:31 PST 2005


Hi, Miguel,

Miguel de la Fuente wrote:

> RETURN 'BOX3D('||($1-100)::VARCHAR ||'
> '||($2-100)::varchar||','||($1+100)::VARCHAR||'
> '||($2+100)::varchar||')'::BOX3D;

Your ::BOX3D cast tries to cast the last string ')' to a Box3d due to
operator precedence (just like the ::varchar casts).

Try the following:

RETURN ('BOX3D('||($1-100)::VARCHAR ||' '||($2-100)::varchar||','||
($1+100)::VARCHAR||''||($2+100)::varchar||')' ) ::BOX3D;

Or some more readable:

RETURN expand(makepoint(23,42),100)::box3d;

HTH,
Markus



More information about the postgis-users mailing list