you can always break up the geometry collection into individuals geometries like so...<br><br><span style="font-family: courier new,monospace;">create or replace function breakup (geometry) returns void as $$</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">declare</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> geom geometry;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">begin</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> for i in 1..NumGeometries($1) loop</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> geom := GeometryN($1, i);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> // add to new table</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> end loop;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">end;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$$ language plpgsql;
</span><br style="font-family: courier new,monospace;"><br>you can also write a PL/PGSQL function that returns a set of geometries from the geometrycollection, like this...<br><br><span style="font-family: courier new,monospace;">
create or replace function foobar (geometry) returns setof geometry as $$</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">declare</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> geom geometry;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">begin</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> for i in 1..NumGeometries($1) loop</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return next GeometryN($1, i);
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> end loop;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
return;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">end;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
$$ language plpgsql;</span><br><br>the call like this...<br><br><span style="font-family: courier new,monospace;">select * from foobar(Collect(GeomFromText('POINT(1 1)'),GeomFromText('POINT(1 2)')));</span><br><br>of course a wrapper function could be used to iterate over all geoms in a table, all geoms in a bbox, etc.
<br><div><span class="gmail_quote">On 12/4/06, <b class="gmail_sendername">Akio Takubo</b> <<a href="mailto:takubo@saruga-tondara.net">takubo@saruga-tondara.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello Alessandro,<br><br>I'm also trying to use a geometry collection column<br>with PostGIS layer just now. It is a interesting topic for me.<br>Does anyone have a nice experience with Geometry Collection<br>column?<br><br>
As far as I know, Mapserver and other some applications<br>do not support Geometry collection column perfectly.<br>In Mapserver, as I tested some cases and saw mappostgis.c,<br>each layer type works following.<br>* POINT shows point and all nodes of linestring and polygon
<br> if there is no nested geometry collction.<br>* LINE shows all linestrings and polygons<br> If there are point or geometry collection, it does not work correctly<br>* POLYGON shows all polygons.<br> If three are other types of geometry, it does not work collectly.
<br><br>Totally, now it is no consideration of mixed geometry types or<br>includes nested geometry collction in PostGIS.<br><br>Is it a bug or specification for no consideration for these geometry<br>at force_to_~ functions in
mappostgis.c?<br>And Mapserver uses force_collection function for fetching geometry,<br>but force_collection does not extract a nested geometry collection.<br>I think it is better force_collection (or other new function)<br>
works all nested geometry collection (and multi~ types).<br><br>Best regards,<br><br> Akio Takubo<br><br>On Mon, 4 Dec 2006 11:15:12 +0100<br>Alessandro Pasotti <<a href="mailto:ale.pas@TISCALI.IT">ale.pas@TISCALI.IT</a>
> wrote:<br><br>> Hello,<br>><br>> I have a layer where the_geom is a geometrycollection (of linestrings), is it<br>> possible to show it in mapserver 4.10?<br>><br>> What "type" (POINT, POLYGON or whatever) should I set?
<br>><br>> --<br>> Alessandro Pasotti<br>> itOpen - "Open Solutions for the Net Age"<br>> w3: <a href="http://www.itopen.it">www.itopen.it</a><br>> Linux User# 167502<br>><br></blockquote></div>
<br><br clear="all"><br>-- <br>Regards,<br><br>Mark Thomas<br><a href="mailto:spatialguru.net@gmail.com">spatialguru.net@gmail.com</a><br>205.529.9013<br><br>"Commit to the Lord whatever you do,<br> and your plans will succeed." - Proverbs 16:3