[OpenLayers-Users] Change style only for one feature on a layer

Arnd Wippermann arnd.wippermann at web.de
Wed Jul 9 11:59:26 EDT 2008


I know the example, but i think that's not useable, because I have no rule
for the feature I want to change the style.

Arnd 

________________________________

Von: alexandre.ardhuin.dw at gmail.com [mailto:alexandre.ardhuin.dw at gmail.com]
Im Auftrag von Alexandre Ardhuin
Gesendet: Mittwoch, 9. Juli 2008 08:33
An: Arnd Wippermann
Cc: users at openlayers.org
Betreff: Re: [OpenLayers-Users] Change style only for one feature on a layer


You can use OpenLayers.StyleMap :
http://openlayers.org/dev/examples/stylemap.html

Alexandre.


2008/7/8 Arnd Wippermann <arnd.wippermann at web.de>:


	Hi,
	
	How can I change the style only for a single feature on a layer.
	
	Using the below code I change the style for all features on a layer.
But I
	have no clue, how to do this only for one feature. I hope someone
can help
	me.
	
	var feature=vlayer.features[vlayer.features.length-1];
	
	var obj=feature.layer.styleMap.styles.default.defaultStyle;
	
	obj.fillColor=strokeColor;
	obj.fillOpacity=fillOpacity;
	obj.strokeColor=strokeColor;
	obj.pointRadius=pointRadius;
	obj.strokeWidth=strokeWidth;
	
	vlayer.drawFeature(feature);}
	
	Mit freundlichen Grüssen
	
	Arnd Wippermann
	http://gis.ibbeck.de/ginfo/
	
	
	_______________________________________________
	Users mailing list
	Users at openlayers.org
	http://openlayers.org/mailman/listinfo/users
	






More information about the Users mailing list