[OpenLayers-Users] GML, Point and Change the Size of the Circle...

Kit Plummer kitplummer at gmail.com
Fri Aug 29 17:37:15 EDT 2008


On Aug 29, 2008, at 12:59 AM, Andreas Hocevar wrote:

> Kit Plummer wrote:
>> Ok, first let me plead practical ignorance here.  I've only been   
>> working with OpenLayers for about a week.  And, I'm integrating it   
>> into ExtJS.  I have a known GML file that contains Points.  I'd  
>> like  to be able to add an attribute to each element that would  
>> specify the  size of the circle that gets drawn by OL.  Am I out of  
>> luck here?  If  not, would somebody be so nice as to point me in  
>> the right direction?
>
> Have a look at http://www.openlayers.org/dev/examples/styles-rotation.html 
> .
>
> You will want to use a style map, and define the pointRadius  
> property of the symbolizer. Say you have a field called "size" in  
> your GML features. Then your stylemap constructor call could look  
> like that:
>
> new OpenLayers.StyleMap({
>   "default": OpenLayers.Util.applyDefaults({
>       pointRadius: "${size}"
>   }, OpenLayers.Feature.Vector.style["default"]
> });
>
> Regards,
> Andreas.

Ok, so that works...curious now if it is possible to make the  
gml:points features so I can use a select like this:

var myStyles = new OpenLayers.StyleMap({
				"default": new OpenLayers.Style({
					pointRadius: "${size}", // sized according to size element from  
GML source
					fillColor: "#ffcc66",
					strokeColor: "#ff9933",
					fillOpacity: 0.1,
					strokeWidth: 2
					}),
					"select": new OpenLayers.Style({
						fillColor: "#66ccff",
						strokeColor: "#3399ff"
					})
				}
			);

			olmap.addLayer(new OpenLayers.Layer.GML("GML", gml, {styleMap:  
myStyles}));

Thanks again.

Kit






More information about the Users mailing list