[postgis-users] points to polyline or polygon

David Blasby dblasby at refractions.net
Wed Jul 16 11:59:39 PDT 2003


Tyler Mitchell wrote:
> Thanks David, exactly what I was looking for.
> 
> Do you not see a benefit to using pl functions instead, since there is no
> library compilation requirement.

You cannot directly access the GEOMETRY datastructure in pl, only using "C".

You could use something like:

CREATE FUNCTION multipoint2linestring (GEOMETRY) returns GEOMETRY AS
'select 
GeometryFromText(replace(asText($1),''MULTIPOINT'',''LINESTRING''), 
srid($1))' language 'sql' with (iscachable,isstrict);

This one is doing it in text-land instead of in the object-land.
You could improve this function using plpgsql - making it easy to do 
error checking and the like.

dave






More information about the postgis-users mailing list