Thanks for replying mike, I will give this a try. Can I ask why are these
line stricken? 

 
var lineFeature = new OpenLayers.Feature.Vector(line, null, style);
lineLayer.addFeatures([li

neFeature]);

 

did you mean to do that?

Miguel

 

 

From: Mike Ryan [mailto:[email protected]] 
Sent: Tuesday, October 09, 2012 4:09 PM
To: [email protected]; [email protected]
Subject: Re: [OpenLayers-Users] KML icons point

 

That example doesn't give you the nuts and bolts of programmatically
creating the line.

This does:
http://stackoverflow.com/questions/2735944/drawing-a-path-with-a-line-in-ope
nlayers-using-javascript




var lineLayer = new OpenLayers.Layer.Vector("Line Layer"); 
 
map.addLayer(lineLayer);

var points = new Array(
   new OpenLayers.Geometry.Point(lon1, lat1),
   new OpenLayers.Geometry.Point(lon2, lat2)
);
 
var line = new OpenLayers.Geometry.LineString(points);
 
var style = { 
  strokeColor: '#0000ff', 
  strokeOpacity: 0.5,
  strokeWidth: 5
};
 
var lineFeature = new OpenLayers.Feature.Vector(line, null, style);
lineLayer.addFeatures([li
neFeature]);


And it wouldn't hurt to have the API at your fingertips for LineString:
http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLay
ers/Geometry/LineString-js.html

On 10/9/2012 3:48 PM, miguel wrote:

Hi 
Forgive me with  the noob question  I have successfully using my own custom
map tiles for doing diagram. The problem I have now encountered is how do I
draw the lines programmatically. I found this example page
http://openlayers.org/dev/examples/draw-feature.html  but looking at the
source code does not reveal much to me. Does anyone have have an example
using x and y coordinates or long lattitute on how to draw lines on a map. I
would greatly appreciated.
Miguel
 
_______________________________________________
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