[OpenLayers-Users] How to draw a arrow with openlayer?

Imran Rajjad rajjad at gmail.com
Wed Jan 23 06:28:05 PST 2013


Hi,

you can make a feature whose geometry is a GeometryCollection, this
collection can contain a line and a point grouped into one geometry then
you can use the below mentioned style to draw an arrow with your line


{
strokeColor: "#00688B",
    fillColor: "#00688B",
    fillOpacity : 1.0,
    strokeWidth: 2,
    strokeOpacity : 0.9,
    pointRadius: 6,
    graphicName :"triangle",
    rotation :angle
}

remember to compute the angle before setting this .. you should be able to
calculate angle between start and end point of your line segment.. and also
the position of point geometry which will be drawn as triage with given
rotation angle..

Hope I got my point through..

regards,
Imran

On Wed, Jan 23, 2013 at 7:11 PM, 杨华杰 <yhjhoo at gmail.com> wrote:

> Hi Alexandre
>
> Thank you, I will try this.
>
>
> Regards,
> Hua Jie
>
>
> On Wed, Jan 23, 2013 at 10:01 PM, Alexandre Dubé <adube at mapgears.com>wrote:
>
>>  Hi Hua Jie,
>>
>> 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 13-01-23 07:09 AM, 杨华杰 wrote:
>>
>> Hi
>>
>>  As the title
>>
>>  I know how to draw a line, dot, polygon. But my customer need some
>> directions on the map
>>
>>
>>  Regards,
>> Hua Jie
>>
>>
>> _______________________________________________
>> Users mailing listUsers at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>>
>>
>> --
>> Alexandre Dubé
>> Mapgearswww.mapgears.com
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>


-- 
I.R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130123/44723f88/attachment-0001.html>


More information about the Users mailing list