[OpenLayers-Users] Cluster Strategy with KML feed layer

Allan allanhenderson at gmail.com
Wed Nov 19 06:58:07 EST 2008


Hey,

I'm trying to set up a cluster strategy on a V.Earth/Openlayers setup, with
a KML file in ESPG 4326 format.

Using this code:

var marker_style = ({
	'pointRadius' : "${radius}",
	'fillColor' : '#9ED652', 
	'fillOpacity' : 0.8,
	'strokeColor' : '#ffffff',
	'strokeWidth' : '1',
	'strokeOpacity' : 0.8 
	}, {
       context: {
          radius: function(feature) {
              return Math.min(feature.attributes.count, 7) + 3;
          }
       }
});

var options = {
	'projection': new OpenLayers.Projection("EPSG:900913"),
	'displayProjection': new OpenLayers.Projection("EPSG:4326"),
        'units': "m",
        'maxResolution': 156543.0339,
	'maxExtent' : new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
	'controls':[new OpenLayers.Control.Navigation(), new
OpenLayers.Control.ZoomPanel()], 
	'numZoomLevels' : 18
	};
	// base map
	map = new OpenLayers.Map('map', options);
	// - MS Virtual Earth Layer
	var baselayer = new OpenLayers.Layer.VirtualEarth("Virtual Earth",{ 'type':
VEMapStyle.Hybrid, "sphericalMercator": true});
	map.addLayer(baselayer);
	
	// Controls for the map
	map.addControl(new OpenLayers.Control.LayerSwitcher());

	var layermarkers = new OpenLayers.Layer.Vector("Markers",{
                    strategies: [
                    new OpenLayers.Strategy.Fixed(),
                    new OpenLayers.Strategy.Cluster()],
                    protocol: new OpenLayers.Protocol.HTTP({
		    url: "kml/placemarks.kml",
		    format: new OpenLayers.Format.KML({
                        internalProjection: map.getProjectionObject(),
                        externalProjection: map.displayProjection 
                    })
      }),
      styleMap:new OpenLayers.StyleMap({
        "default": marker_style,
        "select": {
            fillColor: "#8aeeef",
            strokeColor: "#32a8a9"
        }
       })
      });


But for some reason I simply cannot get it to work - Anyone have any idea
what I'm missing?

Many Thanks

Allan

-- 
View this message in context: http://n2.nabble.com/Cluster-Strategy-with-KML-feed-layer-tp1518817p1518817.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list