
code in openlayer2
var linearRing = new OpenLayers.Geometry.LinearRing(vertices); return new OpenLayers.Geometry.Polygon([linearRing]);Here vertices is the array of points successfully drawn like the imagein openlayer 3
var layerLines = new ol.layer.Vector({ source: new ol.source.Vector({ features: [new ol.Feature({ geometry: new ol.geom.LineString(markers, 'XY'), })] }) //style: iconStyle }); map.addLayer(layerLines);Working but cant fill the in between area.if we replace geometry: new ol.geom.LineString(markers, 'XY'), line by this
geometry: new ol.geom.Polygon(markers, 'XY'), then it cant draw a polygon
أكثر...