I am drawing vector lines, using GeoJSON, in my web application that uses Openlayers. I want the line to be displayed in yellow color with black border. I am using the following for the line styling:

my_layer = new OpenLayers.Layer.Vector("my_layer", {
            styleMap: new OpenLayers.StyleMap(new OpenLayers.Style({
                    fillColor: "#ffff00",
                    strokeWidth: 6,
                    strokeColor: "#000000"            

But 'fillcolor' does not affect line symbology. How can I achieve that effect?


You can't fill a line so you need to draw a thick black line and then a thin yellow line.

  • How can I add more than one style property to a single layer. Should it be 'Rule Based Styling'?
    – thelastray
    Nov 23 '11 at 7:11
  • you need two layers or it won't work properly at the joins.
    – Ian Turton
    Nov 23 '11 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.