[Geoserver-users] Multi line Label with background graphic

Hello All,

I am trying to create an opaque square behind my text labels. This works
beautifully when the label is only 1 line but when I have 2 lines, the
square is shifted upward and not fully behind the text. I have tried to
change the anchor point of the graphic and have also tinkered with the
various vendor options but nothing seems to work...
this is what it currently looks like:
<http://osgeo-org.1560.x6.nabble.com/file/n5144484/labelbox_off.jpg&gt;

Here is my code so far, any help would be much appreciated!

  <NamedLayer>
    <Name>Production</Name>
    <UserStyle>
      
      <Title>test</Title>
      <Abstract>Basin bubbles based on Sum value</Abstract>
      
      <FeatureTypeStyle>
        <Rule>
          <Name>Variable</Name>
          <Title>Variable</Title>
          <ogc:Filter>
            <ogc:PropertyIsGreaterThan>
              <ogc:PropertyName>val</ogc:PropertyName>
              <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsGreaterThan>
          </ogc:Filter>
          <MinScaleDenominator>9244667.36</MinScaleDenominator>

          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#DA291C</CssParameter>
                </Fill>
                <Stroke>
                  <CssParameter name="stroke">#000000</CssParameter>
                  <CssParameter name="stroke-width">1</CssParameter>
                </Stroke>
              </Mark>
              
              <Size>
                <ogc:Mul>
                  <ogc:Literal>100</ogc:Literal>
                  <ogc:PropertyName>pct</ogc:PropertyName>
                </ogc:Mul>
              </Size>
            </Graphic>
          </PointSymbolizer>

          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>basin</ogc:PropertyName>
              <ogc:Function name="numberFormat">
                <ogc:Literal>######.##</ogc:Literal>

                <ogc:Div>
                <ogc:PropertyName>val</ogc:PropertyName>
                <ogc:Literal>1000000</ogc:Literal>
              </ogc:Div>

              </ogc:Function>
              <ogc:Function name="Concatenate">
              <ogc:Literal>BCF</ogc:Literal>
            </ogc:Function>

            </Label>
            
              <CssParameter name="font-family">Arial</CssParameter>
              <CssParameter name="font-size">12</CssParameter>
              <CssParameter name="font-style">normal</CssParameter>
              <CssParameter name="font-weight">bold</CssParameter>
             
          <LabelPlacement>
           <PointPlacement>

             <AnchorPoint>
               <AnchorPointX>0.5</AnchorPointX>
               <AnchorPointY>0.5</AnchorPointY>
             </AnchorPoint>
               `<Displacement>
                  <DisplacementX>0</DisplacementX>

                  <DisplacementY>
                    <ogc:Add>
                    <ogc:Mul>
                      <ogc:Literal>50</ogc:Literal>
                      <ogc:PropertyName>pct</ogc:PropertyName>
                    </ogc:Mul>
                      <ogc:Literal>12</ogc:Literal>
                    </ogc:Add>
                  </DisplacementY>
                </Displacement>
           </PointPlacement>
         </LabelPlacement>

              <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#FFFFFF</CssParameter>
                  <CssParameter name="fill-opacity">0.4</CssParameter>
                </Fill>
              </Mark>
            </Graphic>
            <Halo></Halo>
         <Fill>
           <CssParameter name="fill">#000000</CssParameter>
         </Fill>

            <VendorOption name="graphic-resize">stretch</VendorOption>
            <VendorOption name="graphic-margin">5</VendorOption>

            <VendorOption name="autoWrap">120</VendorOption>
       </TextSymbolizer>
        </Rule>

        <Rule>
          <Name>Inside Circle</Name>
          <Title>40% of parent circle</Title>
           <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#771D26</CssParameter>
                </Fill>
              </Mark>

              <Size>
                <ogc:Mul>
                  <ogc:Literal>40</ogc:Literal>
                  <ogc:PropertyName>pct</ogc:PropertyName>
                </ogc:Mul>
              </Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>

Thanks!

-Kyle B

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Multi-line-Label-with-background-graphic-tp5144484.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On Fri, Jun 6, 2014 at 6:14 PM, kylebrennan <kyle.brennan@anonymised.com>
wrote:

Hello All,

I am trying to create an opaque square behind my text labels. This works
beautifully when the label is only 1 line but when I have 2 lines, the
square is shifted upward and not fully behind the text. I have tried to
change the anchor point of the graphic and have also tinkered with the
various vendor options but nothing seems to work...
this is what it currently looks like:
<http://osgeo-org.1560.x6.nabble.com/file/n5144484/labelbox_off.jpg&gt;

I believe this has been recently fixed as part of this:
http://jira.codehaus.org/browse/GEOT-4309

Unfortunately the fix was done in spare time, with not enough time
to do thorough testing on it, so it was applied only to the development
series, not the stable one.

If you like, you could check if things work for you using the nightly
builds of the development series here:
http://ares.boundlessgeo.com/geoserver/master/

Cheers
Andrea

--

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Thank you so much for the response!

I'm not really sure how i would use the nightly build to overcome this
problem.. Not positive on how to use this or incorporate it.

Any help on this would be much appreciated!!

Thanks,

Kyle B

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Multi-line-Label-with-background-graphic-tp5144484p5144710.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

It is a “release” of geoserver that is generated by a build box, you would install this release (rather then the safe production release.

If the nightly build fixes your problem we would love the verification that it works for you.

I made a pretty landing page for the nightly build here:

http://geoserver.org/release/master/

···

Jody Garnett

On Mon, Jun 9, 2014 at 7:09 AM, kylebrennan <kyle.brennan@anonymised.com> wrote:

Thank you so much for the response!

I’m not really sure how i would use the nightly build to overcome this
problem… Not positive on how to use this or incorporate it.

Any help on this would be much appreciated!!

Thanks,

Kyle B


View this message in context: http://osgeo-org.1560.x6.nabble.com/Multi-line-Label-with-background-graphic-tp5144484p5144710.html

Sent from the GeoServer - User mailing list archive at Nabble.com.


HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://www.hpccsystems.com


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users