[OpenLayers-Users] Changing the colour of a GML layer

Pierre GIRAUD bluecarto at gmail.com
Thu Jul 5 07:38:38 EDT 2007


You are right, you are missing something. In fact, you're mixing two
different things.

The map.addLayer method only accepts one single parameter.

map.addLayer(new OpenLayers.Layer.GML("Regions", "gml/output.gml"));

If you want to apply a style to your GML layer, you must give it as an option.

map.addLayer(new OpenLayers.Layer.GML("Regions", "gml/output.gml",
{style: style_green}));

Regards

Pierre

On 7/5/07, kaka <drspencer at hotmail.com> wrote:
>
> Hi
> I would like to change the colour of a small GML layer (polygons) from the
> standard orange to, say, green. I found the example
> http://www.openlayers.org/dev/examples/vector-features.html , but I am
> having trouble following it. I have added the sections
>
> var style_green = {
>                 strokeColor: "#00FF00",
>                 strokeOpacity: 1,
>                 strokeWidth: 3,
>                 pointRadius: 6,
>                 pointerEvents: "visiblePainted"
>             };
>
> and ...,null,style_green
>
> but it isn´t working and I am quite sure I have missed something. My file is
> at http://www.villageografica.com/test50/GMLcolour.html . Any suggestions
> warmly welcome.
>
> Regards,
>
> Magnus
> --
> View this message in context: http://www.nabble.com/Changing-the-colour-of-a-GML-layer-tf4027134.html#a11439299
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list