[postgis-users] Re: Aggregate?
Stephen Crawford
src176 at psu.edu
Thu Mar 1 13:42:50 PST 2007
That's exactly what I needed. Thanks a lot. -Steve
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Thursday, March 01, 2007 4:41 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Re: Aggregate?
Stephen Crawford wrote:
> I don't quite understand this part:
> "Use collect(geometryn(the_geom, 1)) id your data is specified as
> singular multigeometries."
If you've loaded your data from shape files, then your POLYGON features will
all be MULTIPOLYGON by default, even if they all have only one part. So when
you Collect() them, you'll get a GEOMETRYCOLLECTION instead of a
MULTIPOLYGON.
GeometryN(the_geom,1) turns one-part MULTIPOLYGONS into simple POLYGONS, so
that when you Collect() the result is a MULTIPOLYGON.
> Also, if I want to keep a few of the record for based on another
> another value, should this work?:
>
> SELECT name, party, collect(the_geom)) AS the_geom,
> FROM constituencies
> GROUP BY constituencies.name, constituencies.party;
This will return one collection for each distinct combination of name and
party.
Paul
--
Paul Ramsey
Refractions Research
http://www.refractions.net
pramsey at refractions.net
Phone: 250-383-3022
Cell: 250-885-0632
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list