Hi,

I am working through some issues with labeling my latitude lines on the extreme 
right side of a WMS pull.  I have the labels generating where I want, but only 
for a couple of specific zoom levels.  What I would like to do is determine how 
much space a given label would be in degrees (since I am using 4326 for 
everything) and subtract that from the edge of my wms_bbox.  I got the log 
algorithm from:
http://gis.stackexchange.com/questions/159197/can-textsymbolizer-font-size-be-set-as-a-function-of-the-scale

This is the SLD rule:

                  <sld:Rule>
                                <sld:Name>default rule</sld:Name>
                                <sld:LineSymbolizer>
                                  <sld:Stroke>
                                                <sld:CssParameter 
name="stroke">#66A61E</sld:CssParameter>
                                  </sld:Stroke>
                                </sld:LineSymbolizer>
                                <sld:TextSymbolizer>
                                  <sld:Geometry>
                                                <ogc:Function 
name="geomFromWKT">
                                                  <ogc:Function 
name="Concatenate">
                                                                
<ogc:Literal>POINT(</ogc:Literal>
                                                                <ogc:Function 
name="parseDouble">
                                                                                
<ogc:Function name="strSubstring">
                                                                                
                <ogc:Sub>
                                                                                
                                <ogc:Function name="strSubString">
                                                                                
                                                <ogc:Function name="env">
                                                                                
                                                                
<ogc:Literal>wms_bbox</ogc:Literal>
                                                                                
                                                </ogc:Function>
                                                                                
                                                <ogc:Add>
                                                                                
                                                                <ogc:Function 
name="strIndexOf">
                                                                                
                                                                                
<ogc:Function name="env">
                                                                                
                                                                                
                <ogc:Literal>wms_bbox</ogc:Literal>
                                                                                
                                                                                
</ogc:Function>
                                                                                
                                                                                
<ogc:Literal>:</ogc:Literal>
                                                                                
                                                                </ogc:Function>
                                                                                
                                                                
<ogc:Literal>2</ogc:Literal>
                                                                                
                                                </ogc:Add>
                                                                                
                                                <ogc:Function name="strIndexOf">
                                                                                
                                                                <ogc:Function 
name="env">
                                                                                
                                                                                
<ogc:Literal>wms_bbox</ogc:Literal>
                                                                                
                                                                </ogc:Function>
                                                                                
                                                                
<ogc:Literal>,</ogc:Literal>
                                                                                
                                                </ogc:Function>
                                                                                
                                </ogc:Function>
                                                                                
                <!-This section is attempting to move the Y coordinate left a 
little bit to display the text portion -->

                                                                                
                                <ogc:Add>
                                                                                
                                                <ogc:Mul>
                                                                                
                                                                <ogc:Div>
                                                                                
                                                                                
<ogc:Sub>
                                                                                
                                                                                
                <ogc:Div>
                                                                                
                                                                                
                                <ogc:Literal>1</ogc:Literal>
                                                                                
                                                                                
                                <ogc:Function name="log">
                                                                                
                                                                                
                                                <ogc:Function name="env">
                                                                                
                                                                                
                                                                
<ogc:Literal>wms_scale_denominator</ogc:Literal>
                                                                                
                                                                                
                                                </ogc:Function>
                                                                                
                                                                                
                                </ogc:Function>
                                                                                
                                                                                
                </ogc:Div>
                                                                                
                                                                                
                <ogc:Literal>0.0513</ogc:Literal>
                                                                                
                                                                                
</ogc:Sub>
                                                                                
                                                                                
<ogc:Literal>0.08</ogc:Literal>
                                                                                
                                                                </ogc:Div>
                                                                                
                                                                
<ogc:Literal>.13</ogc:Literal>
                                                                                
                                                </ogc:Mul>
                                                                                
                                                <ogc:Literal>1</ogc:Literal>
                                                                                
                                </ogc:Add>
                                                                                
                </ogc:Sub>
                                                                                
                <ogc:Literal>0</ogc:Literal>
                                                                                
                <ogc:Literal>8</ogc:Literal>
                                                                                
</ogc:Function>
                                                                </ogc:Function>
                                                                
<ogc:Literal><![CDATA[ ]]></ogc:Literal>
                                                                <ogc:Function 
name="getY"><ogc:Function 
name="endPoint"><ogc:PropertyName>geom</ogc:PropertyName></ogc:Function></ogc:Function>
                                                                
<ogc:Literal>)</ogc:Literal>
                                                  </ogc:Function>
                                                </ogc:Function>
                                </sld:Geometry>
                                                <sld:Label>
                                                <ogc:Function 
name="strSubstring">
                                                  
<ogc:PropertyName>bottom</ogc:PropertyName>
                                                  <ogc:Function name="parseInt">
                                                                
<ogc:Literal>0</ogc:Literal>
                                                  </ogc:Function>
                                                  <ogc:Function 
name="strIndexOf">
                                                                
<ogc:PropertyName>bottom</ogc:PropertyName>
                                                                
<ogc:Literal>.</ogc:Literal>
                                                  </ogc:Function>
                                                </ogc:Function>
                                                </sld:Label>
                                  <sld:Font>
                                                <sld:CssParameter 
name="font-family">Arial</sld:CssParameter>
                                                <sld:CssParameter 
name="font-size">15.0</sld:CssParameter>
                                                <sld:CssParameter 
name="font-style">normal</sld:CssParameter>
                                                <sld:CssParameter 
name="font-weight">normal</sld:CssParameter>
                                  </sld:Font>
                                  <sld:Fill>
                                                <sld:CssParameter 
name="fill">#FF00FF</sld:CssParameter>
                                  </sld:Fill>
                                </sld:TextSymbolizer>
                  </sld:Rule>

Chris Snider
Senior Software Engineer
Intelligent Software Solutions, Inc.
[Description: Description: Description: cid:[email protected]]

------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to