Greg Ederer wrote:
Hi,

I am new to GeoTools. I need to render point features in a JMapPane with each point represented by a dot with some adjacent text (the value of a feature attribute). I can render the dots using:

*snip*

Greg,

I too struggled with this when I first started messing with GT. Once I switched from trying to code Styles and Symbolizers directly in my Java code to using SLD, it became much easier. Below is an example of a Rule that contains a TextSymbolizer that I am actively using right now. The label is actually being placed on a polygon shape, but I think it may still be a useful example. Have a look at the SLD class.

        <Rule>
           <TextSymbolizer>
              <Label>
                 <ogc:PropertyName>COUNTYNAME</ogc:PropertyName>
              </Label>
              <LabelPlacement>
                 <PointPlacement>
                    <AnchorPoint>
                       <AnchorPointX>0.5</AnchorPointX>
                       <AnchorPointY>0.5</AnchorPointY>
                    </AnchorPoint>
                    <Displacement>
                       <DisplacementX>0</DisplacementX>
                       <DisplacementY>0</DisplacementY>
                    </Displacement>
                 </PointPlacement>
              </LabelPlacement>
              <Font>
                 <CssParameter name="font-family">SansSerif</CssParameter>
                 <CssParameter name="font-style">bold</CssParameter>
                 <CssParameter name="font-size">8</CssParameter>
              </Font>
              <Fill>
                 <CssParameter name="fill">#000000</CssParameter>
              </Fill>
           </TextSymbolizer>
        </Rule>

HTH

Matt


--
The cosmos is all that is or ever was or ever will be.
-- Carl Sagan

begin:vcard
fn:Matt Foster - N0EYE
n:Foster;Matt
org:;NWS Forecast Office - Norman OK
email;internet:[EMAIL PROTECTED]
title:Information Technology Officer
tel;work:(405) 325-3406
x-mozilla-html:TRUE
version:2.1
end:vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to