[postgis-users] Select largest polygon of a multipolygon ?

Arnaud Lesauvage thewild at freesurf.fr
Wed Jul 12 01:32:12 PDT 2006


strk at refractions.net wrote:
> On Tue, Jul 11, 2006 at 07:29:44PM +0200, Arnaud Lesauvage wrote:
>> Nahum Castro a écrit :
>> >select the area, order by area desc and limit to 1
>> 
>> You did not understand the question nore did you read previous 
>> answers.
>> "Is there a simple way to get the largest polygon of a 
>> multipolygon geometry ?"
>> I can't find another way to explain that, but it seems that my 
>> question is not clear.
> 
> See dump() and the two previous posts.
> (yes, I understood you made it, but might be useful for others)

I tried with dump(), but I am not familiar with set returning 
functions at all, and postgresql's documentation is not very 
expansive on this matter.

For example :
SELECT gid, Area(geom(Dump(uu_geometry))) FROM uu
GROUP BY gid, Area(geom(Dump(uu_geometry)));
works fine, but
SELECT gid, Max(Area(geom(Dump(uu_geometry)))) FROM uu
GROUP BY gid;
does not work : "set-valued function called in context that cannot 
accept a set"

Why is it so ?

--
Arnaud




More information about the postgis-users mailing list