Polygon outline width

Gilles Bassière gilles.bassiere at MAKINA-CORPUS.COM
Mon Jul 30 05:57:42 PDT 2007


Here is my mapfile. The complete Mapfile has 8 other layers but I 
removed them in order to make it easy to read, anyway all layers have 
the same properties (only the color change).
I also tried to set the OUTLINECOLOR property at the CLASS level and to 
use the value -1 0 0 but the outline is still not transparent.

# WGS 84 (epsg:4326)
MAP
   NAME                "Test"
   IMAGETYPE           "png"
   EXTENT              3.3 50.75 7.25 53.6
   IMAGECOLOR          255 255 255
   FONTSET             "/home/gba/public_html/fonts.txt"
   SYMBOLSET           "/home/gba/public_html/symbols.sym"
   UNITS               dd

   PROJECTION
      "init=epsg:4326"
   END

   WEB
      IMAGEPATH        "/home/gba/public_html/img/"
      IMAGEURL         "/img/"
      METADATA
         "wms_title"            "Road map"
         "wms_onlineresource"   "http://localhost/~gba/cgi-bin/test.cgi?"
         "wms_srs"              "epsg:4326"
      END
   END

   # Legend
   LEGEND
      KEYSIZE          10 5
      LABEL
         TYPE          bitmap
         SIZE          medium
         COLOR         0 0 0
         PARTIALS      false
      END
      STATUS           on
   END

   # Scale bar
   SCALEBAR
      IMAGECOLOR       255 255 255
      LABEL
         COLOR         0 0 0
         SIZE          tiny
      END
      STYLE            1
      SIZE             50 2
      COLOR            0 0 0
      UNITS            meters
      INTERVALS        2
      STATUS           on
   END

   OUTPUTFORMAT
      NAME             "png"
      DRIVER           "GD/PNG"
      MIMETYPE         "image/png"
      IMAGEMODE        "rgba"
      EXTENSION        "png"
      FORMATOPTION     "transparent=on"
      FORMATOPTION     "interlace=on"
   END

   
##########################################################################
   # Start of LAYER Definitions 
---------------------------------------------
   
##########################################################################

   # LAYER 9 : water -------------------------------------
   LAYER
      NAME             "water"
      GROUP            "background"
      CONNECTIONTYPE   postgis
      CONNECTION       "host=localhost dbname=test user=test 
password=xxxxx port=5432"
      DATA             "wkb_geometry FROM water"
      STATUS           on
      TYPE             polygon
      TRANSPARENCY     alpha

      PROJECTION
         "init=epsg:4326"
      END
     
      CLASS
         STYLE
            COLOR         153 179 204
            OUTLINECOLOR  -1 -1 -1
            ANTIALIAS     true
         END
      END

      METADATA
         "wms_title"   "Water bodies"
         "wms_srs"     "EPSG:4326"
         "wms_extent"  "3.3 50.75 7.25 53.6"
      END
   END
END

# test URL (GetMap) : 
http://localhost/~gba/cgi-bin/test.cgi?service=wms&version=1.1.1&request=getmap&layers=background&styles=&srs=epsg:4326&width=800&height=600&format=image/png&bbox=3.358400,50.750400,7.227600,53.555000
> Hi Gilles
>
> How does sour map-file look? OUTLINECOLOR -1 0 0 definitely should work.
>
> Mit freundlichem Gruss / Best Regards
> Flavio Hendry
>
> ----------------------------------------------------------------
> TYDAC Web-Site:  http://www.tydac.ch
> TYDAC MapServer: http://www.mapserver.ch
> ----------------------------------------------------------------
> ############      Mit freundlichen Gruessen / Kind Regards
> ############             mailto:flavio at tydac.ch
> ############         TYDAC AG - http://www.tydac.ch
> ####    ####        Geographic Information Solutions
> ####    ####         Luternauweg 12 -- CH-3006 Bern
> ############   Tel +41 (0)31 368 0180 - Fax +41 (0)31 368 1860
> ----------------------------------------------------------------
>
>
> -----Original Message-----
> From: Gilles Bassière <gilles.bassiere at makina-corpus.com>
> To: Flavio Hendry <flavio at tydac.ch>
> Cc: MAPSERVER-USERS at LISTS.UMN.EDU
> Date: Mon, 30 Jul 2007 11:58:00 +0200
> Subject: Re: [UMN_MAPSERVER-USERS] Polygon outline width
>
>   
>> Hi Flavio
>>
>> Thanks for your help. Unfortunately, it has no effect on my map. I
>> tried 
>> to set this value for OUTLINE in the CLASS element, then in the STYLE
>> element but rivers still appear very thick on my map when the scale
>> in 
>> large... Actually, the same map is produced with OUTLINE -1 0 0 or 
>> without. =(
>>
>> As explained in the FAQ, I tried to set up a circle symbol but it
>> seems 
>> to work only for true lines, not for polygon outlines.
>>
>> Any other idea ?
>>
>> Gilles
>>     
>>> Hi Gilles
>>>
>>> just set the OUTLINECOLOR to -1 0 0.
>>>
>>> Mit freundlichem Gruss / Best Regards
>>> Flavio Hendry
>>>
>>> ----------------------------------------------------------------
>>> TYDAC Web-Site:  http://www.tydac.ch
>>> TYDAC MapServer: http://www.mapserver.ch
>>> ----------------------------------------------------------------
>>> ############      Mit freundlichen Gruessen / Kind Regards
>>> ############             mailto:flavio at tydac.ch
>>> ############         TYDAC AG - http://www.tydac.ch
>>> ####    ####        Geographic Information Solutions
>>> ####    ####         Luternauweg 12 -- CH-3006 Bern
>>> ############   Tel +41 (0)31 368 0180 - Fax +41 (0)31 368 1860
>>> ----------------------------------------------------------------
>>>
>>>
>>> -----Original Message-----
>>> From: Gilles Bassière <gilles.bassiere at MAKINA-CORPUS.COM>
>>> To: MAPSERVER-USERS at LISTS.UMN.EDU
>>> Date: Fri, 27 Jul 2007 15:09:22 +0200
>>> Subject: [UMN_MAPSERVER-USERS] Polygon outline width
>>>
>>>   
>>>       
>>>> Hi there,
>>>>
>>>> I wonder whether it's possible to have no outline for a polygon.
>>>> My first attempt was to set the WIDTH property of the STYLE
>>>>         
>> element
>>     
>>>> to 0 
>>>> in my MapFile but I got an error from MapServer, it seems to be an
>>>> invalid value.
>>>> As I might need to display the same data through GeoServer, I
>>>>         
>> decided
>>     
>>>> to 
>>>> move all style information to a SLD. I wrote the following SLD :
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <StyledLayerDescriptor
>>>>                version="1.0.0"
>>>>                xmlns="http://www.opengis.net/sld"
>>>>                xmlns:gml="http://www.opengis.net/gml"
>>>>                xmlns:ogc="http://www.opengis.net/ogc"
>>>>                xmlns:xlink="http://www.w3.org/1999/xlink"
>>>>               
>>>>         
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>     
>>>>                xsi:schemaLocation="http://www.opengis.net/sld 
>>>> http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd"
>>>>  >
>>>>    <!-- WATER -->
>>>>    <NamedLayer>
>>>>       <Name>water</Name>
>>>>       <UserStyle>
>>>>          <FeatureTypeStyle>
>>>>             <Rule>
>>>>                <Name>Water bodies</Name>
>>>>                <PolygonSymbolizer>
>>>>                   <Fill>
>>>>                      <CssParameter
>>>>         
>> name="fill">#99b3cc</CssParameter>
>>     
>>>>                   </Fill>
>>>>                   <Stroke>
>>>>                      <CssParameter
>>>> name="stroke">#0000FF</CssParameter>
>>>>                      <CssParameter
>>>> name="stroke-width">0.0</CssParameter>
>>>>                   </Stroke>
>>>>                </PolygonSymbolizer>
>>>>             </Rule>
>>>>          </FeatureTypeStyle>
>>>>       </UserStyle>
>>>>    </NamedLayer>
>>>> </StyledLayerDescriptor>
>>>>
>>>> My map is rendered without any error but there is still an
>>>>         
>> outline. I
>>     
>>>> tried to set opacity to 0.0 but it's not supported by MapServer. I
>>>> can 
>>>> set the same color for stroke and fill but having a 1px outline
>>>>         
>> means
>>     
>>>> that a very thin river is rendered with, at least, a 2 pixels
>>>>         
>> width
>>     
>>>> and 
>>>> this is not really nice when viewing the map at higher scales...
>>>> If I remove the Stroke element Mapserver seems to set
>>>>         
>> automatically a
>>     
>>>> 1px outline using the fill color.
>>>>
>>>> Does anyone know a workaround to get rid of polygon outlines ?
>>>>
>>>> -- 
>>>> Gilles Bassiere
>>>> MAKINA CORPUS
>>>> 30 rue des Jeuneurs
>>>> FR-75011 PARIS
>>>> http://www.makina-corpus.com
>>>>     
>>>>         
>> -- 
>> Gilles Bassiere
>> MAKINA CORPUS
>> 30 rue des Jeuneurs
>> FR-75011 PARIS
>> http://www.makina-corpus.com
>>     
>
>
>   


-- 
Gilles Bassiere
MAKINA CORPUS
30 rue des Jeuneurs
FR-75011 PARIS
http://www.makina-corpus.com



More information about the MapServer-users mailing list