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

Tim Schaub tschaub at opengeo.org
Fri Jan 9 13:44:39 EST 2009


Hey-

Dave Potts wrote:
> Christopher Schmidt wrote:
> Hi Chris
> 
> Thank you for such a prompt answer,  I had expect the colour information 
> to be kept in the gml file. But I have a play with this interface.

If you really are delivering style data with your features (feature 
attributes with colors for example), you can use those attribute names 
in your symbolizers.

See the doc Chris put together for this bit:

var s = new OpenLayers.Style({
   'pointRadius': 10,
   'externalGraphic': '${thumbnail}'
});

That would assume you have a "thumbnail" attribute in on your feature 
(in your GML).  You can imagine the same for fillColor etc.

Also see the style related examples:
http://openlayers.org/dev/examples/?q=style

Tim



> Dave.
>> On Wed, Jan 07, 2009 at 07:56:27PM +0000, Dave Potts wrote:
>>  
>>> Is there any way of setting     the colour that is used to draw a gml 
>>> feature?
>>>     
>>
>> Yes.
>>     http://docs.openlayers.org/library/feature_styling
>>
>>  
>>> Dave
>>>     
>>
>>  
>>> begin:vcard
>>> fn:David Potts
>>> n:Potts;David
>>> x-mozilla-html:FALSE
>>> version:2.1
>>> end:vcard
>>>
>>>     
>>
>>  
>>> _______________________________________________
>>> 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


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list