Hi all,
I am trying to render an external graphic (which works out fine). Now I also
want to apply a displacement to move it a bit to the right.
Unfortunately the image stays where it is and does not seem to move a bit. It
does not seem to make a difference whether I put in values for displacement or
Anchorpoint.
Here's my code and the resulting sld:
FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory();
StyleBuilder sb = new StyleBuilder();
Graphic graphic = sb.createGraphic();
URL url = getClass().getClassLoader().getResource("image.png");
ExternalGraphic external = sb.createExternalGraphic( url, "image/png");
graphic.graphicalSymbols().clear();
graphic.graphicalSymbols().add( external );
graphic.setSize(filterFactory.literal(85));
graphic.setDisplacement(sb.createDisplacement(50, 50)); // displacement is
measured in pixels
PointSymbolizer pointSymbolizer = styleFactory.createPointSymbolizer(graphic,
null);
pointSymbolizer.getOptions().put("maxDisplacement", "150");
rule.symbolizers().add(pointSymbolizer);
<?xml version="1.0" encoding="UTF-8"?>
<sld:Graphic xmlns="http://www.opengis.net/sld"
xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml">
<sld:ExternalGraphic>
<sld:OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple" xlink:href="file:/path/to/image.png"/>
<sld:Format>image/png</sld:Format>
</sld:ExternalGraphic>
<sld:Size>85</sld:Size>
<sld:Displacement>
<sld:DisplacementX>50.0</sld:DisplacementX>
<sld:DisplacementY>50.0</sld:DisplacementY>
</sld:Displacement>
</sld:Graphic>
Am I missing something here?
------------------------------------------------------------------------------
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://p.sf.net/sfu/hpccsystems
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users