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

Eric Lemoine eric.c2c at gmail.com
Sat Aug 30 02:51:43 EDT 2008


Kit, your code with the select style added to the style map looks
correct. Then, in case you haven't figured that out yet, you can use
the select feature control to select/unselect features (on click, or
hover, or drawing a box). Cheers. Eric

2008/8/29, Kit Plummer <kitplummer at gmail.com>:
>
> 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
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list