[OpenLayers-Dev] Tiled WFS layer (need feedback)

Martijn van Oosterhout kleptog at gmail.com
Tue Feb 12 04:10:04 EST 2008

[Not for 2.6]. I've finally gotten around to doing tiled WFS "the
right way" as some would put it. After some discussion on IRC it was
decided the best way would be to have a new "singleTile: false" option
to support the tiled mode. A couple of points which relate to

- WFS will now inherit from Vector, Markers and Grid

so instead of having WFS doing its own tile loading stuff, it reuses
the singletile mode from Grid. This removes a bit of duplicate code.

- The url argument of Tile.WFS is basically unused

After this the tiles (even in singleTile mode) will use the getURL
function of the layer with the bounds to determine the URL, just like
TMS does. The URL is slated for removal in 3.0 so I doubt anyone will
be bothered by this.

- Feature lifecycle management

Currently the Tile.WFS fetches features and passes them to the layer
and forgets about them. For tiled mode you can't really do this, since
you need to know which features go away when a tile moves out of
range. So in tiled mode the tile manage their own features, adding and
removing from the layer as appropriate. What I would like to do is
that even in singleTile mode the tile manages the features: this opens
up the path of, when dragging/zooming in singleTile mode, a new tile
is created and populated before deleting the old one, to avoid
flickering (I beleive something similar is planned for TMS?).

This is a API change and I'd like to know what people think on this point.

- Managing of duplication between WFS tiles

One of the harder parts of tiled WFS is that a single feature can
exist in multiple tiles. The way this is managed is by reference
counting the features based on the fid of the feature. Anonymous
features (fid==null) are assumed unique. I beleive this fits with most
people's expectations. It does assume that server will always pass
complete features and won't require the client to merge multiple

- Adding internal/external projection support

The script I was using on the server isn't really a WFS server so I
needed to adjust the URL generation to reproject the bounding boxes
based on the external projection. This is perhaps an orthoginal
feature and should be submitted seperately.

- The refresh function

WFS has a refresh function that no-one else has. I'm unclear as to
what it's supposed to do. It appears to remove all the features and
the call the tile to readd them or something. It doesn't appear to
want to refresh from the server though, so what's the point. Can
someone enlighten me?

- Tile size

For TMS the tilesize is fixed by the size of the images. For WFS the
tilesize is essentially arbitrary. On the one hand you could say the
tilesize size should be a fixed portion of the map, so zooming doesn't
need to go to the server at all. OTOH, a server may want to return
different details depending on the zoom-level. For the moment I've
punted on this and pretended it's just like TMS but it's something to

Looking forward to your responses,
Martijn van Oosterhout <kleptog at gmail.com> http://svana.org/kleptog/

More information about the Dev mailing list