[OpenLayers-Dev] OpenLayers.Strategy.Cluster() - feature.geometry is null

Ivan Grcic ivan.grcic at geofoto.hr
Mon Oct 27 11:49:44 EDT 2008


Heh...i figured it out finally :)

As my subject says feature.geometry is null - there was some features
that didnt have geometry.

So I guess there has to be some if(feature. geometry != null) inside
cluster class!

Regards,
Ivan



On Mon, Oct 27, 2008 at 4:45 PM, Ivan Grcic <ivan.grcic at geofoto.hr> wrote:
> Hi list (or should i say hi Eric :)
>
> I have a problem with using cluster strategy. I use gml file exported
> with geoserver getFeature request to display my vector layer.
> When using "normal" gml layer i get my features displayed without
> problem, so i guess that means my GML file is valid:
>
> myGmlLayer= new OpenLayers.Layer.GML("My name", "fileFromGeoserver.gml");
>
> When using that same file but with cluster strategy, i get following
> error in my firebug window
>
>
> feature.geometry is null
>                         OpenLayers.js (line 535)
> return exist;},shouldCluster:function(cl...ck:this.merge,scope:this});return
> true;}
>
> this is my code for cluster layer:
>    var style = new OpenLayers.Style({
>        pointRadius: "${radius}",
>     }, {
>        context: {
>          radius: function(feature) {
>                        return Math.min(feature.attributes.count,4) + 3;
>          }
>        }
>     });
>
>        myGmlLayer= new OpenLayers.Layer.Vector("GML", {
>                                        strategies: [new OpenLayers.Strategy.Fixed(), new
> OpenLayers.Strategy.Cluster()],
>                    protocol: new OpenLayers.Protocol.HTTP({
>                                                url: "fileFromGeoserver.gml",
>                        format: new OpenLayers.Format.GML()
>                    }),
>
>                    styleMap:new OpenLayers.StyleMap({
>                          "default": style,
>                          }
>                        })
>
>
>        });
>
> Should my features inside gml file have some particular syntax for
> geometry column? Hmm i dont think so, because it gets displayed
> properly with OpenLayers.Layer.GML...
>
> Any thoughts about it? I can post a bit of gml file if necessary..
>
> Regards,
> Ivan
>



More information about the Dev mailing list