On Mon, Feb 27, 2006 at 08:41:52PM +0200, Volkan YAZICI wrote: > 2 weeks ago, a user in -tr-genel asked for a function to break > path/polygon type data into pieces. He also told that, it creates a > bottleneck in the network traffic when they try to receive rows with > polygon data of thousands of nodes, while it's enough for them to > have polygons partially. > > AFAIK, there doesn't exist such functions in PostgreSQL. (Please > correct me if I'm wrong.) For this purpose, I've coded two simple > C procedures: > > polygon part(polygon, offset, limit) > path part(path, offset, limit) PostGIS has geometry accessors that might work. You'd need to be using PostGIS geometry types instead of the PostgreSQL types. http://postgis.refractions.net/docs/ch06.html Are the following examples anything like what the user in tr-general was looking for? postgis=> SELECT AsText(geom) FROM foo; astext ---------------------------------------------------------- POLYGON((0 0,10 0,10 10,0 10,0 0),(1 1,9 1,9 9,1 9,1 1)) (1 row) postgis=> SELECT AsText(ExteriorRing(geom)) FROM foo; astext ------------------------------------- LINESTRING(0 0,10 0,10 10,0 10,0 0) (1 row) postgis=> SELECT AsText(InteriorRingN(geom, 1)) FROM foo; astext --------------------------------- LINESTRING(1 1,9 1,9 9,1 9,1 1) (1 row) postgis=> SELECT n, AsText(PointN(ring, n)) postgis-> FROM (SELECT ExteriorRing(geom) AS ring FROM foo) AS s, postgis-> generate_series(1, 2) AS g(n); n | astext ---+------------- 1 | POINT(0 0) 2 | POINT(10 0) (2 rows) postgis=> SELECT AsText(MakeLine(PointN(ring, n))) postgis-> FROM (SELECT ExteriorRing(geom) AS ring FROM foo) AS s, postgis-> generate_series(1, 2) AS g(n); astext ---------------------- LINESTRING(0 0,10 0) (1 row) postgis=> SELECT AsText(line_substring(ExteriorRing(geom), 0, 0.25)) postgis-> FROM foo; astext ---------------------- LINESTRING(0 0,10 0) (1 row) -- Michael Fuhr