[OpenLayers-Users] Cluster strategy and extract attributes?

Joanne Cook j.cook at oxfordarch.co.uk
Thu Dec 11 10:44:52 EST 2008


Hi Chris,

Yes, you're absolutely right I should provide some code:

Ext.onReady(function() {
        
	var mystyle = new OpenLayers.Style({
	'pointRadius': "${radius}",
	'fillColor': "#ffcc66",
	'fillOpacity': 0.8,
	'strokeColor': "#cc6633",
	'strokeWidth': 2,
	'strokeOpacity': 0.8},
	{context: {
		radius: function(feature) {
		return Math.min(feature.attributes.count, 7)+3;
		}
	}
	}
			
	);

----more code-----

wfs = new OpenLayers.Layer.Vector("OA Sites WFS", {
		strategies: [new OpenLayers.Strategy.Fixed(), new OpenLayers.Strategy.Cluster()],
		protocol: new OpenLayers.Protocol.HTTP({
		url: "http://10.0.10.106/cgi-bin/mapserv900913.cgi?",
		params: {
			format: "WFS",
			service: "WFS",
			version: "1.0.0",
			request: "GetFeature",
			typename: "oasites_wfs",
			SRS: "EPSG:900913"},
			format: new OpenLayers.Format.GML()
			}),
                        styleMap: new OpenLayers.StyleMap({
				"default": mystyle,
				"select": {fillColor: "#8aeeef",
					strokeColor: "#32a8a9"
					}
				})
			});

Thanks

Jo


-----------------------------------------------------
Joanne Cook
Senior IT Support and Development
Oxford Archaeology (North)
01524 880212
http://thehumanjourney.net

----- Original Message -----
From: "Christopher Schmidt" <crschmidt at metacarta.com>
To: "Joanne Cook" <j.cook at oxfordarch.co.uk>
Cc: "users" <users at openlayers.org>
Sent: Thursday, 11 December, 2008 15:40:09 GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: [OpenLayers-Users] Cluster strategy and extract attributes?

On Thu, Dec 11, 2008 at 03:26:04PM +0000, Joanne Cook wrote:
> Dear All,
> 
> I have implemented a cluster strategy for WFS points on my map, as per
> the example in the documentation. It might just be me, but to get it
> to work at all I had to swap from using OpenLayers.Layer.WFS to
> OpenLayers.Layer.Vector, with a Protocol statement to make up the URL.
> When I tried to add in the "extractAttributes: true" parameter, my
> page didn't display, though it worked fine if I took that statement
> out. However, if I still want to be able to click on a point (when I'm
> down to points representing single sites) and get information, is it
> possible to do that at all? Currently my attributes in the popup just
> show us as "undefined". Was I right to change from Layer.WFS to
> Layer.Vector?

Strategies require the use of Layer.Vector, yes. I don't know where you
added your extractAttributes parameter, but it's most likely that you
need to configure your protocol with a format object ,and in the
creation of that format object, pass the extractAttributes option.

Can you provide code that you have currently, or a link? It is easier to
review a minimal example of the current behavior/problem than it is to
guess how you might be doing things.

Regards,
-- 
Christopher Schmidt
MetaCarta



------
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.




More information about the Users mailing list