title: GeoServer:How to create label Postion(Horizontal and Vertical) only on for outside boundary from layer Properties
body: <p>I have the grid shapefile that contains properties of the Polygon Grid.I imported into GeoServer and created the grid layer.And for the style of the layer, I created SLD File with LabelPlacement contains Anchor X and Y position for the label to display in the middle of the polygon.It's working fine.
  The following is the SLD style:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;StyledLayerDescriptor version="1.0.0" 
   xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
   xmlns="http://www.opengis.net/sld" 
   xmlns:ogc="http://www.opengis.net/ogc" 
   xmlns:xlink="http://www.w3.org/1999/xlink" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;!-- a Named Layer is the basic building block of an SLD document --&gt;
    &lt;NamedLayer&gt;
      &lt;Name&gt;default_polygon&lt;/Name&gt;
      &lt;UserStyle&gt;
      &lt;!-- Styles can have names, titles and abstracts --&gt;
        &lt;Title&gt;Default Polygon&lt;/Title&gt;
        &lt;Abstract&gt;A sample style that draws a polygon&lt;/Abstract&gt;
        &lt;!-- FeatureTypeStyles describe how to render different features --&gt;
        &lt;!-- A FeatureTypeStyle for rendering polygons --&gt;
        &lt;FeatureTypeStyle&gt;
          &lt;Rule&gt;
            &lt;Name&gt;rule1&lt;/Name&gt;
            &lt;Title&gt;Gray Polygon with Black Outline&lt;/Title&gt;
            &lt;Abstract&gt;A polygon with a gray fill and a 1 pixel black outline&lt;/Abstract&gt;
  
            &lt;PolygonSymbolizer&gt;
              &lt;Stroke&gt;
                &lt;CssParameter name="stroke"&gt;#0000FF&lt;/CssParameter&gt;
                &lt;CssParameter name="stroke-width"&gt;1.5&lt;/CssParameter&gt;
              &lt;/Stroke&gt;
            &lt;/PolygonSymbolizer&gt;
            &lt;TextSymbolizer&gt;
              &lt;Label&gt;
                0&lt;ogc:PropertyName&gt;TWP&lt;/ogc:PropertyName&gt;-0&lt;ogc:PropertyName&gt;RGE&lt;/ogc:PropertyName&gt;W&lt;ogc:PropertyName&gt;M&lt;/ogc:PropertyName&gt;
              &lt;/Label&gt;
              &lt;Font&gt;
                &lt;CssParameter name="font-family"&gt;Times New Roman&lt;/CssParameter&gt;
                &lt;CssParameter name="font-style"&gt;Normal&lt;/CssParameter&gt;
                &lt;CssParameter name="font-size"&gt;14&lt;/CssParameter&gt;
              &lt;/Font&gt;
  
              &lt;LabelPlacement&gt;
                &lt;PointPlacement&gt;
                  &lt;AnchorPoint&gt;
                    &lt;AnchorPointX&gt;0.5&lt;/AnchorPointX&gt;
                    &lt;AnchorPointY&gt;0.5&lt;/AnchorPointY&gt;
                  &lt;/AnchorPoint&gt;
                &lt;/PointPlacement&gt;
              &lt;/LabelPlacement&gt;
             &lt;!-- 
              &lt;Displacement&gt;
                  &lt;DisplacementX&gt;25&lt;/DisplacementX&gt;
                  &lt;DisplacementY&gt;0&lt;/DisplacementY&gt;
              &lt;/Displacement&gt;
              --&gt;
  
              &lt;Fill&gt;
                 &lt;CssParameter name="fill"&gt;#0000FF&lt;/CssParameter&gt;
              &lt;/Fill&gt;
  
            &lt;/TextSymbolizer&gt;
          &lt;/Rule&gt;
        &lt;/FeatureTypeStyle&gt;
      &lt;/UserStyle&gt;
    &lt;/NamedLayer&gt;
  &lt;/StyledLayerDescriptor&gt;
  </code></pre>
  
  <p>And getting output is:</p>
  
  <p><a href="https://i.stack.imgur.com/NcKhc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NcKhc.png" alt="enter image description here"></a></p>
  
  <p><strong>But how to assign the Label Horizontal and Vertical only for Outer Boundary of the Grid from layer properties.I want Label like the following image:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/UtnHD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UtnHD.png" alt="enter image description here"></a></p>
  
  <p>I tried label Displacement and AnchorPoint.Don't know how to create(Horizontal and Vertical Label).</p>
  
  <p>Please, any help.</p>