[postgis-users] Using OGC / PostGIS data types in PL/PGSQL functions

Chip Masters chip_masters at yahoo.com
Thu Feb 9 11:56:19 PST 2006


Hello all,

I am starting to write some PL/PGSQL scripts that
utilize PostGIS data types and functions, and I notice
that there seems to be some difficulty when using the
PostGIS 'Point' and 'Polygon' data types as arg
constraints, since (I presume) there is ambiguity
between these and the PostgreSQL datatypes of the same
name. For example, I have included two functions in
the attached file:

> counterClockwisePoints(Point, Point, Point)

and

> counterClockwiseGeometries(Geometry, Geometry, 
> Geometry)

both interpret fine when I load them into my database
using PSQL, however counterClockwisePoints throws an
error. When I try

> select 
> 
> counterClockwisePoints
>   (PointFromText('POINT(0 0)', -1),
>    PointFromText('POINT(1 0)', -1),
>    PointFromText('POINT(1 1)', -1));

I get

> ERROR:  function counterclockwisePoints(geometry, 
> geometry, geometry) does not exist

while selecting counterClockwiseGeometries with the
same args works as expected. Again, I assume this is
because when I use 'Point' as the arg constraint in
counterClockwisePoints, PostgreSQL interprets this as
its 'point' data type instead of the PostGIS one. Am I
right? Is there a way to explicitly declare the
PostGIS  data types so there is no ambiguity?

Thanks in advance for any help,

Chip Masters



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file1
Type: application/octet-stream
Size: 1521 bytes
Desc: 215579040-file1
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060209/8ed53b20/attachment.obj>


More information about the postgis-users mailing list