<div dir="ltr">

<p class="MsoNormal">Hi Everyone</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I have some styling to do in OpenLayers that is proving to
be a challenge for me.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I have an incident management map that is used to draw
features. One of the features that needs to be drawn is a cordon (polygon)
around the incident. Access and exit points can be added to the cordon boundary
(on a separate point layer). For clarity these points need to be displayed as
arrows pointing onto the line, from inside for exit points and from outside for
access points. The image in the link below shows what I mean.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"><a href="http://tinypic.com/view.php?pic=15g2ep&s=5#.Ut4tVvvFKUk">http://tinypic.com/view.php?pic=15g2ep&s=5#.Ut4tVvvFKUk</a></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">The bit I’m struggling with is how to rotate a point based
on the line it is being placed on top of. </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I have set up snapping so that the point is snapped to the
edge of the line.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I am currently using an SLD file to set the stylemap of the
vector layers.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I thought if I could retrieve 2 vertices from the line
closest to my point I could calculate the angle of the line at that point and
use that to set the rotation value, stored as an attribute to be used by the
SLD.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I’ve looked at the distanceTo function of OpenLayers
Geometries but that looks like it will only return the closest vertex from the
line, I couldn’t figure out a way of getting the second closest, and also
thought that it’s not as simple as 2 closest as they might both be one side of
my point. What I really need is the closest point on either side to get an
angle.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">At this point I thought I’d ask to see if anybody had any
better ideas on a way to do this, or if it’s even doable!</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I would be very grateful for any suggestions from people.</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Thanks</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Tom</p>

</div>