1

Geoserver SLD:

  <sld:LineSymbolizer>
    <sld:Stroke>
      <sld:CssParameter name="stroke">
        <ogc:PropertyName>geo_color</ogc:PropertyName>
      </sld:CssParameter>
      <sld:CssParameter name="stroke-width">2</sld:CssParameter>
    </sld:Stroke>
  </sld:LineSymbolizer>
  <TextSymbolizer>
    <Label>
      <ogc:Literal>&#x227b;</ogc:Literal>
    </Label>
    <Font>
      <CssParameter name="font-family">Lucida Sans</CssParameter>
      <CssParameter name="font-size">20</CssParameter>
    </Font>
    <LabelPlacement>
    <LinePlacement>
    <PerpendicularOffset>0</PerpendicularOffset>
    </LinePlacement>
    </LabelPlacement>
    <Fill>
      <CssParameter name="fill">
        <ogc:PropertyName>geo_color</ogc:PropertyName>
      </CssParameter>
    </Fill>
    <VendorOption name="followLine">true</VendorOption>
    <VendorOption name="forceLeftToRight">false</VendorOption>
    <VendorOption name="conflictResolution">false</VendorOption>
  </TextSymbolizer>

I have the above style set for a WMS layer containing line strings. For most zoom levels the direction arrow aligns properly with its corresponding line. But on zooming out beyond a point, the arrows seem to be displaced away from their respective lines. Shown here:

Screenshot showing the issue

I am fairly sure that this has to do something with VendorOption parameters but unable to put a finger on it. Appreciate any inputs to get this sorted out.

  • What are some of the attribute values in the geo_color field? – Devdatta Tengshe Jul 19 '13 at 9:02
  • @DevdattaTengshe they are just hexadecimal color codes like "#ff0000","#ab34f4" etc.. – Siva Jul 19 '13 at 9:14
  • I can reproduce this only on some serpentine lines. I would log this as a Labeling bug, and maybe see if there is some other way of achieving the arrows. (without using Labels) – Devdatta Tengshe Jul 19 '13 at 9:47
-1

You can edit config.yaml file in geoserver to render the arrow....

#===========================================================================
# allowed DPIs
#===========================================================================
dpis:
  - 254
  - 300

#===========================================================================
# allowed Formats
#===========================================================================
# '*' means any formats
formats: ['*']

#===========================================================================
# the allowed scales
#===========================================================================
scales:
  - 188
  - 375
  - 750
  - 1500
  - 3000
  - 6000
  - 12000
  - 24000
  - 48000
  - 96000
  - 192000
  - 384000
  - 768000
  - 1536000
  - 3072000
  - 6144000
  - 12288000


#===========================================================================
# the list of allowed hosts
#===========================================================================


# the default fileName for the files downloaded from the servlet
outputFilename: Export Map

layouts:
  #===========================================================================
  A4 portrait:
  #===========================================================================
    # override the default outputFileName defined above
#    outputFilename: A4_Layout
    mainPage:
      rotation: true
      pageSize: A4
      marginLeft: 40
      marginRight: 40
      marginTop: 20
      marginBottom: 20
      header:
        height: 50
        items:
          - !text
            font: Helvetica
            fontSize: 18
            align: center           
            text: '${mapTitle}' 

      items:
        - !table
            config:
               borderWidth: 1
               borderColor: black
               borderWidthLeft: 1
               borderWidthRight: 1
               borderWidthTop: 1
               borderWidthBottom: 1
               borderColorLeft: black
               borderColorRight:black
               borderColorTop: black
               borderColorBottom: black
            items:
                - !map
                  spacingAfter: 0
                  width: 515
                  border: true
                  borderWidthLeft: 2
                  borderColorLeft: black
                  height: 500
                  align: left
        - !table
            absoluteX: 405
            absoluteY: 772
            width: 150
            height:  100
            config:
               borderWidth: 1
               borderColor: black
               borderWidthLeft: 1
               borderWidthRight: 1
               borderWidthTop: 1
               borderWidthBottom: 1
               borderColorLeft: black
               borderColorRight:black
               borderColorTop: black
               borderColorBottom: black
            items:
               - !image
                 rotation: '${rotation}'
                 maxWidth: 50
                 maxHeight: 50
                 url: 'http://localhost:8080/geoserver/www/images/2.png'
                 align: RIGHT
                 vertAlign: MIDDLE
               - !text
                  font: Helvetica
                  fontSize: 6
                  align: LEFT
                  vertAlign: MIDDLE
                  text: 'scale:   1 : ${scale} ' 
        - !table
            config:
               borderWidth: 1
               borderColor: black
               borderWidthLeft: 1
               borderWidthRight: 1
               borderWidthTop: 1
               borderWidthBottom: 1
               borderColorLeft: black
               borderColorRight:black
               borderColorTop: black
               borderColorBottom: black
            items:
                - !legends
                   maxIconWidth: 0
                   maxIconHeight: 0
                   classIndentation: 0
                   layerSpace: 3
                   classSpace: 2
                   backgroundColor: #FFFFFF
                   layerFont: Helvetica
                   layerFontSize: 8
                   classFont: Helvetica
                   classFontSize: 6
                   textMaxWidth: 5
                   textMaxHeight: 5
                   iconMaxHeight: 5
                   inLine: false
                   fontEncoding: Cp1252
                   columnMargin: 3
        - !text
          text: '${mapComment}'
          spacingAfter: 25
      footer:
        height: 20
        items:
          - !columns
            items:
              - !text    
                fontSize: 8
                fontColor:#7D7877               
                align: left


              - !text   
                fontSize: 8           
                align: center
                text: '${pageNum}'
              - !text
                font: Helvetica
                fontSize: 8
                align: right            
                text: '${now MM.dd.yyyy}'

enter image description here

Printing a map in geoserver using config.yaml file...

|improve this answer|||||
  • 2
    Can you give more information about which part of this answer will actually make the arrow, and how it is doing it? – Devdatta Tengshe Jul 19 '13 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.