[OpenLayers-Users] Point symbolizer: triangle + orientation line

Gabriel Vatin gabriel.vatin at mines-paristech.fr
Fri Jul 27 08:08:30 PDT 2012


Hi Alexandre,

Thanks for your advice. I think I saw this kind of solution here : 
http://gaganb.wordpress.com/2010/09/30/draw-line-direction-on-openlayers-feature/
But he's using it for line features.

I'll try to find if there is a way to use it to modify point feature (I 
don't need any arrow symbol, but just a line at the top of a triangle, 
both of them would have a rotation then).

Gabriel

Le 27/07/2012 16:38, Alexandre Dubé a écrit :
> Hi Gabriel,
>
>   You could try to define your own arrow symbol.  There's one defined 
> [here], see line 1 :
>
> OpenLayers.Renderer.symbol.arrow = [0,2, 1,0, 2,2, 1,0, 0,2]
>
>   I haven't tried it, but it could do the trick.
>
> HTH,
>
> Alexandre
>
> [here] 
> http://code.google.com/p/rep-olnet/source/browse/trunk/Direction.js?r=61
>
>
> On 12-07-27 10:18 AM, Gabriel Vatin wrote:
>> Hello,
>>
>> I'd like to represent mobile objects (WFS layer of points) with a 
>> triangle, and a line to show the direction and speed of it. Right 
>> now, I can use the default "triangle" symbolizer :
>>
>> symbolizer: {
>> rotation: '${heading}',
>>     pointRadius: 6.5,
>>     graphicName: 'triangle',
>>     strokeColor: 'white',
>>     fillColor: color,
>>     strokeOpacity: 0.3,
>>     strokeWidth: 2,
>>     fillOpacity: 0.7
>> }
>>
>> Then I use the rotation attribute to turn the trangle. The triangle 
>> object is a isosceles triangle, but it is so small that we can't 
>> really see its orientation. So is there a method to draw a triangle 
>> and a line at the top of it to show the direction ?
>> I just tried to add a new WFS layer with the same origin, but an 
>> other symbolizer :
>>
>> defaultStyleD = new OpenLayers.Style({
>>     rotation: '${heading}',
>>     pointRadius: 25,
>>     externalGraphic: './img/line.png',
>>     graphicYOffset: -50
>> });
>>
>> The line.png is an image I made myself. If I display the 2 layers at 
>> the same time, that's the kind of result that I want to see... but 
>> this is only a trick, and not a real good way to answer my problem !
>> Do you have any idea ?
>>
>> Thanks,
>>
>> Gabriel
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>



More information about the Users mailing list