[mapserver-users] Usage of Vendor Option

David Alda Fernandez de Lezea dalda at ikt.es
Mon Nov 23 00:18:05 PST 2009


 
Hello, 

Thanks for your response. Just to clarify I've just added the comments bellow:

>From a quick test I did locally using latest MapServer, I don;t see any particular issues with your sld. I was able to generate the labels as expected. 

I'm also able to generate the labels, but the problem is that some of them are cut and thay are also repeated over the polygon. See attached file.

>Note that the anchor position is only used when labeling point features.

I thought it could be possible to add a label in the centroid of the polygon, and just one label.

>Are each polygon formed with one shape or could one polygon be formed by several adjacent shapes?

I don't understand what you mean here. I'm using Oracle Spatial as DataSource and my layer is a polygon table.

>You can also check the log files and see what your layer looks like after the sld is applied: add something like this in your map file for example:
> CONFIG  "MS_ERRORFILE" "f:/logs/my_log_file.log"
> DEBUG 5

Here is what I get from the log file

[Mon Nov 23 08:54:37 2009].387000 msApplySLD(): Map file after SLD was applied C:/ms4w/Apache/htdocs/MFD/tmp/4b0a3fbd_1058_1._sld.map[Mon Nov 23 08:54:37 2009].512000 msDrawMap(): Layer 5 (municipios), 0.093s
[Mon Nov 23 08:54:37 2009].512000 msDrawMap(): Drawing Label Cache, 0.000s
[Mon Nov 23 08:54:37 2009].512000 msDrawMap() total time: 0.093s
[Mon Nov 23 08:54:37 2009].528000 msSaveImage() total time: 0.016s
[Mon Nov 23 08:54:37 2009].528000 mapserv request processing time (msLoadMap not incl.): 0.172s
[Mon Nov 23 08:54:37 2009].528000 msFreeMap(): freeing map at 015968D8.

An then I go to the file referenced in the log and I see a mapfile with the following lines, but I don't know what exaclty do I have to find...


MAP
  EXTENT 460000 4708766.29018245 610000 4821233.70981755
  FONTSET "misc/fonts/fonts.txt"
  IMAGECOLOR 255 255 255
  IMAGETYPE png24
  SYMBOLSET "misc/symbols/symbols.sym"
  SHAPEPATH "shapes/"
  SIZE 1152 864
  STATUS ON
  UNITS METERS
  CONFIG MS_ERRORFILE "C:/ms4w/Apache/htdocs/MFD/tmp/ms_wms.log"
  NAME "WMSSERVER"

  DEBUG 5
  OUTPUTFORMAT
    NAME "png24"
    MIMETYPE "image/png; mode=24bit"
    DRIVER "GD/PNG"
    EXTENSION "png"
    IMAGEMODE "RGB"
    TRANSPARENT FALSE
  END

  OUTPUTFORMAT
    NAME "png"
    MIMETYPE "image/png"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE "RGBA"
    TRANSPARENT TRUE
    FORMATOPTION "TRANSPARENT=ON"
    FORMATOPTION "INTERLACE=OFF"
  END

  SYMBOL
    NAME "sld_line_symbol"
    TYPE ELLIPSE
    FILLED TRUE
    POINTS
      1 1
    END
  END

  PROJECTION
    "init=epsg:23030"
  END
  LEGEND
    IMAGECOLOR 255 255 255
    KEYSIZE 20 10
    KEYSPACING 5 5
    LABEL
      SIZE MEDIUM
      TYPE BITMAP
      BUFFER 0
      COLOR 0 0 0
      FORCE FALSE
      MINDISTANCE -1
      MINFEATURESIZE -1
      OFFSET 0 0
      PARTIALS TRUE
    END
    POSITION LL
    STATUS OFF
  END

  QUERYMAP
    COLOR 255 255 0
    SIZE -1 -1
    STATUS OFF
    STYLE HILITE
  END

  SCALEBAR
    ALIGN CENTER
    COLOR 0 0 0
    IMAGECOLOR 255 255 255
    INTERVALS 4
    LABEL
      SIZE MEDIUM
      TYPE BITMAP
      BUFFER 0
      COLOR 0 0 0
      FORCE FALSE
      MINDISTANCE -1
      MINFEATURESIZE -1
      OFFSET 0 0
      PARTIALS TRUE
    END
    POSITION LL
    SIZE 200 3
    STATUS OFF
    STYLE 0
    UNITS MILES
  END

  WEB
    IMAGEPATH "C:/ms4w/Apache/htdocs/MFD/tmp/"
    IMAGEURL "tmp/"
    METADATA
      "wms_srs"	"EPSG:23030 EPSG:4326"
      "wms_onlineresource"	"http://192.168.1.65/cgi-bin/mapserv.exe?map=../htdocs/MFD/ejemplo_wms.map&"
      "wms_abstract"	"Servicio de mapas WMS de IKT Nekazal Teknologia. Powered by Apache and UMN MapServer"
      "wms_transparent"	"true"
      "wms_name"	"IKT WMS Server"
      "wms_feature_info_mime_type"	"application/vnd.ogc.gml"
      "wms_keywordlist"	"IKT,Euskadi,Mapas Euskadi"
      "wms_title"	"Servidor WMS IKT"
    END
    QUERYFORMAT text/html
    LEGENDFORMAT text/html
    BROWSEFORMAT text/html
  END

  LAYER
    CONNECTION "XXXX/XXXX at XXXXX"
    CONNECTIONTYPE ORACLESPATIAL
    DATA "GEOMETRY FROM (SELECT * FROM GT_MUNICIPIOS_96) USING UNIQUE gid SRID 82337"
    DUMP TRUE
    METADATA
      "wms_srs"	"EPSG:23030"
      "wms_extent"	"460000 4710000 610000 4820000"
      "wms_transparent"	"true"
      "wms_name"	"municipios"
      "wms_format"	"image/png"
      "gml_include_items"	"all"
      "wms_server_version"	"1.1.1"
      "wms_title"	"municipios 96"
    END
    NAME "municipios"
    PROJECTION
      "init=epsg:23030"
    END
    STATUS ON
    TYPE POLYGON
    UNITS METERS
    CLASS
      NAME "Unknown"
      LABEL
        SIZE MEDIUM
        TYPE BITMAP
        BUFFER 0
        COLOR 0 0 0
        FORCE FALSE
        MINDISTANCE -1
        MINFEATURESIZE -1
        OFFSET 0 0
        OUTLINECOLOR 255 255 255
        OUTLINEWIDTH 0
        PARTIALS TRUE
        POSITION CC
      END
      MAXSCALEDENOM 65000
      MINSCALEDENOM 30000
      STYLE
        ANGLE 360
        COLOR 102 166 30
        OPACITY 55
        SYMBOL 0
      END
      STYLE
        ANGLE 360
        OPACITY 100
        OUTLINECOLOR 0 234 0
        SIZE 2
        SYMBOL "sld_line_symbol"
      END
      TEXT ([MUNICIPIO])
    END
  END
END

Thanks. Hope you can help me.
 
 
Un saludo,
 
··················································································

David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
 
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)

··················································································
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
··················································································
email: dalda at ikt.es                                web: www.ikt.es
··················································································

-----Mensaje original-----
De: Yewondwossen Assefa [mailto:yassefa at dmsolutions.ca] 
Enviado el: viernes, 20 de noviembre de 2009 15:00
Para: David Alda Fernandez de Lezea
CC: mapserver-users at lists.osgeo.org
Asunto: Re: [mapserver-users] Usage of Vendor Option

David,

 From a quick test I did locally using latest MapServer, I don;t see any particular issues with your sld. I was able to generate the labels as expected. Note that the anchor position is only used when labeling point features.
Are each polygon formed with one shape or could one polygon be formed by several adjacent shapes?  You can also check the log files and see what your layer looks like after the sld is applied: add something like this in your map file for example:
 CONFIG  "MS_ERRORFILE" "f:/logs/my_log_file.log"
DEBUG 5
 
regards,

David Alda Fernandez de Lezea wrote:
> Hi,
>  
> I've got a SLD that I apply to a polygon layer and I want to add a 
> label to identify those polygons. I manage to add the the labels but 
> my problem is that the labels are repeated a lot of times into the 
> polygons and furthermore they don't appear on the centroif of my 
> polygon. Here is my TextSymbolizer tag:
>  
> <TextSymbolizer>
>         <sld:MinScaleDenominator>3000</sld:MinScaleDenominator>
>         <sld:MaxScaleDenominator>5000</sld:MaxScaleDenominator>
>         <Label>
>          <ogc:PropertyName>MUNICIPIO</ogc:PropertyName>         
>         </Label>
>         <Font>
>          <CssParameter name="font-family">Arial</CssParameter>
>          <CssParameter name="font-weight">bold</CssParameter>
>          <CssParameter name="font-size">8</CssParameter>
>         </Font>
>         <!-- this centers the label on the polygon's centroid-->
>         <LabelPlacement>
>           <PointPlacement> 
>           <AnchorPoint>
>             <AnchorPointX>0.5</AnchorPointX>
>             <AnchorPointY>0.5</AnchorPointY>
>           </AnchorPoint>
>           </PointPlacement>        
>         </LabelPlacement>
>          <!--  make the label easy to read-->
>         <Halo>       
>            <Radius>
>            <ogc:Literal>2</ogc:Literal>
>            </Radius>
>            <Fill>
>           <CssParameter name="fill">#FFFFFF</CssParameter>
>           <CssParameter name="fill-opacity">0.85</CssParameter>    
>            </Fill>
>         </Halo>
>         <Fill>
>          <CssParameter name="fill">#000000</CssParameter>  
>         </Fill>
>         <!-- This labels each name only once, not every shape with 
> that name -->
>         <VendorOption name="group">true</VendorOption>
>   </TextSymbolizer>
>  
>
>  
>
>  
>
> Un saludo,
>
>  
>
> ······································································
> ············
>
> *David Alda Fernández de Lezea*
>
> Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y 
> Biodiversidad
>
>  
>
> *IKT*
>
> Granja Modelo s/n · 01192 · Arkaute (Araba)
>
>
> ··················································································
> Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
> ······································································
> ············
> email: dalda at ikt.es 
> <mailto:dalda at ikt.es>                                web: www.ikt.es 
> <http://www.ikt.es/>
> ······································································
> ············
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>   


--
----------------------------------------------------------------
Assefa Yewondwossen           
Software Analyst   

Email: assefa at dmsolutions.ca    
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.JPG
Type: image/jpeg
Size: 68331 bytes
Desc: example.JPG
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20091123/759114a6/attachment.jpe>


More information about the MapServer-users mailing list