[OpenLayers-Users] popup with wfs marker layer...

Christopher Schmidt crschmidt at metacarta.com
Sun Mar 11 12:18:00 EDT 2007


On Sun, Mar 11, 2007 at 09:19:53AM -0600, John Cole wrote:
> Christopher,
>   I'm not married to the markers, but it seems to fit the bill for this
> application.  Will the new WFS allow points to be rendered with a bitmap as
> well as a vector symbol?
> 
>   In either case, it would be very nice to have an option to attach a
> feature level event to vector layers, to handle selection/info/editing of
> WFS features.
> 
>   To make sure I understand how to do what I want with the 2.3 WFS markers,
> I need to create a new class, inherit from OpenLayers.Layer.WFS and override
> the function that populates the markers array, attaching my event handler as
> the markers are created.  That seems ok, but I can't seem to find the
> function that actually loads the markers, could you provide a hint as to
> it's location? :-)

Hm, that's not the way I had intended it to work. Instead, what you
should be able to do is pass a different featureClass option to the
layer. In the default WFS example, it has:  

{ featureClass: OpenLayers.Feature.WFS}

You should subclass OpenLayers.Feature.WFS: It has:

        this.createMarker();
        this.layer.addMarker(this.marker);

in the initialize function: you should probably change this to something
like:
this.marker.events.register('click', this, this.markerClick);
this.layer.addMarker(marker);

and then define a 'markerClick' event on the feature similar to the
Layer.Text.

The more I think about it, the more I feel we probably need to keep the
non-vector WFS layer. Which is a shame, cause I really don't like the
code :) Thanks for the feedback -- let me know if this doesn't help.

Regards, 
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list