postgis geometrycollection in mapserver

Mark Thomas spatialguru.net at GMAIL.COM
Mon Dec 4 10:46:41 EST 2006


you can always break up the geometry collection into individuals geometries
like so...

create or replace function breakup (geometry) returns void as $$
declare
    geom    geometry;
begin
    for i in 1..NumGeometries($1) loop
        geom := GeometryN($1, i);
        // add to new table
    end loop;
    return;
end;
$$ language plpgsql;

you can also write a PL/PGSQL function that returns a set of geometries from
the geometrycollection, like  this...

create or replace function foobar (geometry) returns setof geometry as $$
declare
    geom    geometry;
begin
    for i in 1..NumGeometries($1) loop
        return next GeometryN($1, i);
    end loop;
    return;
end;
$$ language plpgsql;

the call like this...

select * from foobar(Collect(GeomFromText('POINT(1
1)'),GeomFromText('POINT(1 2)')));

of course a wrapper function could be used to iterate over all geoms in a
table, all geoms in a bbox, etc.
On 12/4/06, Akio Takubo <takubo at saruga-tondara.net> wrote:
>
> Hello Alessandro,
>
> I'm also trying to use a geometry collection column
> with PostGIS layer just now. It is a interesting topic for me.
> Does anyone have a nice experience with Geometry Collection
> column?
>
> As far as I know, Mapserver and other some applications
> do not support Geometry collection column perfectly.
> In Mapserver, as I tested some cases and saw mappostgis.c,
> each layer type works following.
> * POINT shows point and all nodes of linestring and polygon
>   if there is no nested geometry collction.
> * LINE shows all linestrings and polygons
>   If there are point or geometry collection, it does not work correctly
> * POLYGON shows all polygons.
>   If three are other types of geometry, it does not work collectly.
>
> Totally, now it is no consideration of mixed geometry types or
> includes nested geometry collction in PostGIS.
>
> Is it a bug or specification for no consideration for these geometry
> at force_to_~ functions in mappostgis.c?
> And Mapserver uses force_collection function for fetching geometry,
> but force_collection does not extract a nested geometry collection.
> I think it is better force_collection (or other new function)
> works all nested geometry collection (and multi~ types).
>
> Best regards,
>
>   Akio Takubo
>
> On Mon, 4 Dec 2006 11:15:12 +0100
> Alessandro Pasotti <ale.pas at TISCALI.IT> wrote:
>
> > Hello,
> >
> > I have a layer where the_geom is a geometrycollection (of linestrings),
> is it
> > possible to show it in mapserver 4.10?
> >
> > What "type" (POINT, POLYGON or whatever) should I set?
> >
> > --
> > Alessandro Pasotti
> > itOpen - "Open Solutions for the Net Age"
> > w3:  www.itopen.it
> > Linux User# 167502
> >
>



-- 
Regards,

Mark Thomas
spatialguru.net at gmail.com
205.529.9013

"Commit to the Lord whatever you do,
    and your plans will succeed." - Proverbs 16:3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20061204/d8e7163c/attachment.html


More information about the mapserver-users mailing list