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

kaka drspencer at hotmail.com
Thu Jul 5 10:14:04 EDT 2007


Ah, yes, thank you Pierre. By the way, how do I control the colour/opacity of
the polygon (currently black) and not just the edges?
http://www.villageografica.com/test50/GMLcolour.html




Pierre GIRAUD wrote:
> 
> 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
>>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://www.nabble.com/Changing-the-colour-of-a-GML-layer-tf4027134.html#a11447188
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list