[mapserver-users] Painting outside a polygon.

Trent Erickson trente at umn.edu
Mon Apr 20 15:14:32 PDT 2009


If you are looking to make one specific feature inside a shapefile with 
multiple features clear or transparent you can use the FILTER parameter 
within the LAYER definition. In addition to setting the IMAGECOLOR at 
the map level to the same color as your layer it may give you the 
results you desire.

Following are two examples of using the FILTER parameter to make one 
part of a shapefile layer disappear. It uses a field in the attributes 
called "shapeid" you could use any field in your shapefile.

# the following will make feature with shapeid 12345 transparent and 
leave the rest of the shapefile with default color rules
FILTER ( "[shapeid]" != "12345" ) 

# the following variation would use the shapeid= parameter provided in 
the URL of cgi mapserver
FILTER ( "[shapeid]" != "%shapeid%" )

-Trent

Ernesto Barrera wrote:
>
>
> Hi there,
>
> I'm dealing with a layer containing polygon data for a given country 
> (shapefile).
> Color inside the polygon can be easily set via COLOR style parameter.
> I'm just looking for a way to apply color to the outside of the 
> polygon (i.e.:, paint the surrounding sea in solid blue)
>
> Is there such a method inside Mapserver?
> Is there a way to 'reverse' the shapefile to indicate that the wanted 
> feature is not inside the boudaries but the complementary area?
>
> Thanks in advance,
>
>
> PD.: My single layer is like this
>
> LAYER
>  NAME        mycountry
>  DATA         mycountry.shp
>  TYPE         POLYGON
>  STATUS ON
>    CLASS
>      NAME       "boundaries"
>      STYLE
>        COLOR        255 0 0   # country area shown in red
>      END
>    END
> END
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>



More information about the MapServer-users mailing list