Created
June 6, 2013 20:05
-
-
Save eloycoto/5724493 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lineLayer = new OpenLayers.Layer.Vector("Line Layer"); | |
map.addLayer(lineLayer); | |
map.addControl(new OpenLayers.Control.DrawFeature(lineLayer, OpenLayers.Handler.Path)); | |
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([lineFeature]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment