Michael, 

Thank you very much!!! That's definately what I needed. I also agree that this 
should be documented anywhere.

Thanks.

Regards. 
 
Un saludo,
 
··················································································

David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
 
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)

··················································································
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
··················································································
email: [email protected]                                web: www.ikt.es
··················································································

-----Mensaje original-----
De: [email protected] 
[mailto:[email protected]] En nombre de Michael
Enviado el: jueves, 25 de noviembre de 2010 15:42
Para: [email protected]
Asunto: Re: [OpenLayers-Users] Is it possible to draw a feature from code??

It sure is!

It's as simple as this code that I use to add a course and two range rings to a 
vector layer.

    var lineFeature = new OpenLayers.Feature.Vector(new 
OpenLayers.Geometry.LineString(coursePlanCoordinates),{color:"#000000"});
     var rangeRing = new OpenLayers.Feature.Vector(new 
OpenLayers.Geometry.Polygon.createRegularPolygon(finish, 100.0/60, 20, 
0),{color:"#999999"});
     var rangeRing2 = new OpenLayers.Feature.Vector(new 
OpenLayers.Geometry.Polygon.createRegularPolygon(finish, 500.0/60, 40, 
0),{color:"#999999"});
     courseLayer.addFeatures([lineFeature, rangeRing, rangeRing2]);

Good luck!

This should be in the examples somewhere.

Michael

On 11/25/2010 6:35 AM, David Alda Fernandez de Lezea wrote:
> Hi list,
>
> Is it possible to draw a feature, a circle for example, from the code?? Not 
> with user interaction.
>
> If it's possible, how??
>
> Un saludo,
>
> ······································································
> ············
>
> David Alda Fernández de Lezea
> Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y 
> Biodiversidad
>
> IKT
> Granja Modelo s/n · 01192 · Arkaute (Araba)
>
> ··················································································
> Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
> ··················································································
> email: [email protected]                                web: www.ikt.es
> ······································································
> ············ _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to