Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Fill Color and Change style of Polygon on OpenLayers Opensource Map

Following code snippets show how to change the filled color and style of polygon on OpenLayers Map. It is tested and working example. :) Thanks.



           //define style for polygon
            var style_poly =
           {
               strokeColor: "#000000",
               strokeOpacity: 1,
               strokeWidth: 2,
               fillColor: "#00FF00",
               fillOpacity: 0.6
            };
            var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
             //------------set style on layer
             polygonLayer.style=style_green;
--------------------------------------------------------------------------------------------------------------
[...]