[postgis-users] ST_Dump-like function for simple (non-multi) geometries ?

Maxime van Noppen maxime at altribe.org
Fri Jul 31 10:18:11 PDT 2009


On 07/31/09 18:36, Kevin Neufeld wrote:
> Unfortunately, not yet.  ST_DumpPoints is on the TODO list as it would
> definitely be useful.
> 
> http://trac.osgeo.org/postgis/browser/trunk/TODO?rev=3485#L31
> http://trac.osgeo.org/postgis/ticket/76
> 
> Cheers,
> Kevin

I was looking to PostGIS source code to see how hard it is to implement
and if I could be of any help but the st_dump function implementation is
quite complicated (at least for somebody exterior to the project).

Is there any reason not to provide the function as an plpgsql
function ? Would a C implementation run really faster ?

The SQL code seems quite simple, I currently use something like :

CREATE FUNCTION dump_line(l geometry) RETURNS SETOF geometry AS $$
BEGIN
  FOR i IN 1..ST_NumPoints(l) LOOP
    RETURN NEXT ST_PointN(l, i);
  END LOOP;
END
$$ LANGUAGE plpgsql;

-- 
yabo



More information about the postgis-users mailing list