Drawing collected multipolygons from PostGIS...

Paul Ramsey pramsey at REFRACTIONS.NET
Wed May 16 19:28:59 EDT 2007


If your source column is MULTIPOLYGON then collect() will generate a 
collection of MULTIPOLYGON, which Mapserver won't be able to draw.

One way to fix that is to use the fact that most MULTIPOLYGONS are 
really single part... just an ordinary POLYGON wrapped in fluff.

DATA "the_geom FROM
(SELECT min(gid) AS gid, collect(geometryn(the_geom,1))
AS the_geom
FROM placecu
WHERE (gid = any (string_to_array('%PLCGID%', '^')))
AND (the_geom && setSRID(!BOX!, 4326)) GROUP BY name) foo
USING SRID=4326,
USING UNIQUE gid"

Matthew Perry wrote:
> On 5/16/07, John Cole <john.cole at uai.com> wrote:
>> Hello,
>>   I'm trying to "pretty" up a polygon layer (specifically tiger placecu).
>> I'd like to draw an outline of a collection of multipolygon objects, 
>> but it
>> doesn't seem to be working.
>>
>> Here is my data statement in my mapfile:
>>
>>         DATA "the_geom from (SELECT min(gid) as gid, collect(the_geom) 
>> as the_geom
>> from placecu
>> WHERE (gid = any (string_to_array('%PLCGID%', '^')))
>> and (the_geom && setSRID(!BOX!, 4326)) group by name) foo USING 
>> SRID=4326,
>> USING UNIQUE gid"
>>
>> If I remove the min/collect the layer draws fine, but I was hoping to get
>> the exterior ring of the combined polygons and draw that.  Has anyone 
>> done
>> something similar?  I'd love an example.
> 
> Have you tried BuildArea(collect(the_geom)) ?
> 


-- 

   Paul Ramsey
   Refractions Research
   http://www.refractions.net
   pramsey at refractions.net
   Phone: 250-383-3022
   Cell: 250-885-0632



More information about the mapserver-users mailing list