[Geoserver-users] SLD: anchor point of a symbol?

Hi,

is there a way to set the achor point of a point symbol (graphic)? I only figured out how to set the anchor point of a label inside a symbol, but not for the whole symbol istself - I need to insert a symbol at its central bottom point.
I tried to define the point placement within the point symbolizer, but it would not work:

<sld:Rule>
   <sld:Name>VKZ</sld:Name>
   <sld:Title>VKZ</sld:Title>
   <ogc:Filter>
     <ogc:PropertyIsEqualTo>
     <ogc:PropertyName>type</ogc:PropertyName>
     <ogc:Literal>vkz</ogc:Literal>
     </ogc:PropertyIsEqualTo>
   </ogc:Filter>
   <sld:PointSymbolizer>
     <sld:Graphic>
       <sld:ExternalGraphic>
         <sld:OnlineResource xlink:href="images/symbols/vkz.png"/>
         <sld:Format>image/png</sld:Format>
       </sld:ExternalGraphic>
       <sld:Size>9</sld:Size>
       <sld:Rotation>${angle}</sld:Rotation>
     </sld:Graphic>
     <sld:PointPlacement>
       <sld:AnchorPoint>
         <sld:AnchorPointX>0.5</sld:AnchorPointX>
         <sld:AnchorPointY>0.0</sld:AnchorPointY>
       </sld:AnchorPoint>
     </sld:PointPlacement>
   </sld:PointSymbolizer>
</sld:Rule>

Thanks for your help!
Uschi

Hi,

Uschi Dorau wrote:

Hi,

is there a way to set the achor point of a point symbol (graphic)? I only figured out how to set the anchor point of a label inside a symbol, but not for the whole symbol istself - I need to insert a symbol at its central bottom point.
  
From the SLD spec: 'The “hot spot” to use for positioning the rendering at a point must either be inherent in the external format or is defined to be the “central point” of the graphic, where the exact definition “central point” is system-dependent.'

In your case, this means that you would have to create a new external graphic with its height doubled, and the symbol shifted to the top of the graphic. If you are working with raster images, it should even be possible to place a raster image inside a svg and use a svg graphic instead, e.g.

<svg xmlns="http://www.w3.org/2000/svg&quot;
    xmlns:xlink="http://www.w3.org/1999/xlink&quot;
    width="50px" height="100px">
    <image x="0" y="0" width="50px" height="50px"
        xlink:href="http://www.openlayers.org/dev/img/marker.png&quot;/&gt;
</svg>

This will save you from creating new raster images. Save this to a file (e.g. foo.svg), and use it as external graphic in your sld, like this:

<ExternalGraphic>
    <OnlineResource xlink:type="simple" xlink:href="foo.svg"/>
    <Format>image/svg+xml</Format>
</ExternalGraphic>

Regards,
Andreas.

Hi Uschi,

Tell me, how do u send that parameter "angle" to the SLD? By the URLs query
string on the GET request or u generate dynamically the sld body before
sending a POST request?

Pedro Mendes

Uschi Dorau wrote:

Hi,

is there a way to set the achor point of a point symbol (graphic)? I
only figured out how to set the anchor point of a label inside a symbol,
but not for the whole symbol istself - I need to insert a symbol at its
central bottom point.
I tried to define the point placement within the point symbolizer, but
it would not work:

<sld:Rule>
   <sld:Name>VKZ</sld:Name>
   <sld:Title>VKZ</sld:Title>
   <ogc:Filter>
     <ogc:PropertyIsEqualTo>
     <ogc:PropertyName>type</ogc:PropertyName>
     <ogc:Literal>vkz</ogc:Literal>
     </ogc:PropertyIsEqualTo>
   </ogc:Filter>
   <sld:PointSymbolizer>
     <sld:Graphic>
       <sld:ExternalGraphic>
         <sld:OnlineResource xlink:href="images/symbols/vkz.png"/>
         <sld:Format>image/png</sld:Format>
       </sld:ExternalGraphic>
       <sld:Size>9</sld:Size>
       <sld:Rotation>${angle}</sld:Rotation>
     </sld:Graphic>
     <sld:PointPlacement>
       <sld:AnchorPoint>
         <sld:AnchorPointX>0.5</sld:AnchorPointX>
         <sld:AnchorPointY>0.0</sld:AnchorPointY>
       </sld:AnchorPoint>
     </sld:PointPlacement>
   </sld:PointSymbolizer>
</sld:Rule>

Thanks for your help!
Uschi

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
View this message in context: http://www.nabble.com/SLD%3A-anchor-point-of-a-symbol--tp19084335p19432213.html
Sent from the GeoServer - User mailing list archive at Nabble.com.