how to draw the line between markers, coordinates of markers undertake from a DB. whether it is possible to draw in general lines between markers, I saw examples only with points.
markers = new OpenLayers.Layer.Markers("Marcadores");
map.addLayer(markers);
if (b == 2)
{
//================= =========
var size = new OpenLayers.Size(30, 30);
var offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
var location = new OpenLayers.LonLat(kor_1,kor_2).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
var icon = new OpenLayers.Icon('http://icons.iconarchive.com/icons/icons-land/vista-map-markers/256/Map-Marker-Ball-Pink-icon.png', size, offset);
markers.addMarker(new OpenLayers.Marker(location, icon.clone()));
var line = new OpenLayers.Geometry.LineString([kor_1, kor_2]);
//================= ==============
}
Best Answer
You need to add a vector layer, and then add a feature to it. See the following code:
You can see a working sample here: http://jsfiddle.net/devdatta/pwuVz/2/