[OpenLayers-Users] Rotating point on a line (Vector features)
Mark Prins
mc.prins at gmail.com
Wed Jan 22 09:29:06 PST 2014
just thinking out loud...
it might be easier to have perpendicular lines created from the points
and symbolize them as arrows assuming that egress would always be on
the inside of the polygon and ingress on the outside.
JSTS would be helpful: http://bjornharrtell.github.io/jsts/doc/api/index.html
2014/1/21 Tom Colley <tomcolley at gmail.com>:
> Hi Everyone
>
>
>
> I have some styling to do in OpenLayers that is proving to be a challenge
> for me.
>
>
>
> 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.
>
>
>
> http://tinypic.com/view.php?pic=15g2ep&s=5#.Ut4tVvvFKUk
>
>
>
> The bit I’m struggling with is how to rotate a point based on the line it is
> being placed on top of.
>
>
>
> I have set up snapping so that the point is snapped to the edge of the line.
>
>
>
> I am currently using an SLD file to set the stylemap of the vector layers.
>
>
>
> 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.
>
>
>
> 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.
>
>
>
> 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!
>
>
>
> I would be very grateful for any suggestions from people.
>
>
>
> Thanks
>
>
>
> Tom
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Disclaimer;
This message is just a reflection of what I thought at the time of
sending. The message may contain information that is not intended for
you or that you don't understand.
More information about the Users
mailing list