Tile Feature Strategy in OpenLayers
No doubt there is a huge requirement for client side vector rendering capabilities. The reason being the user interaction with features can be enhanced that can not be thought in case of tile images.
One critical point for heavy traffic sites is caching of the data. Caching can be considered at server side (http cache) and browser cache to reduce the load on servers. So for caching the vector data requests, we need to request the data from server in predefined extent or tile wise.
I have implemented the client side handling of the tiled vector data request with OpenLayers. OpenLayers has different strategies for requesting the data from server like Fixed, BBOX. Similar way I created a strategy to request the features tile wise and to handle the response, named as Tile Feature Strategy TFS. Here is the working example of TFS with OpenLayers
You can check the TFS class source code that is inherited from OpenLayers Strategy class. I have used GeoJSON format for features. There is slight modification in protocol as well as, check here Protocal_TFS.
Well in this example features returned are not the real features ( as I dont have the data). These features I create for each tile on ad hoc basis but each time in a tile features are same. This is achieved with Knuth algo, check the php code for simulated tile feature service here. The response for given tile is GeoJSON feature collection. Well for your actual data, you need to implement a tile feature service at your own at server end. Can take help of TileStache to generate tile wise GeoJSON.
This approach is not new many efforts have been done earlier also. I see ticket for tiled WFS in OpenLayers. There is microsoft research project for TiledVectors. And there is very nice implementation by Polymaps for Vector Tiles. Here is another open source arcstache for ArcGIS Server.


This looks really interesting! I’ve been searching for some OpenLayers code that replicates the excellent vector tiling in Polymaps, as I also feel there are many strong use cases for this functionality. Kothic JS (http://bit.ly/Q10Btt) implements a similar vector tile format (http://bit.ly/kgP4PH), as does GIS Cloud (http://bit.ly/pkYUR4).
Have you submitted an OpenLayers pull request for this in GitHub?
Hi Homme,
Still I have not made pull request, I have to do, as suggested by Andreas
http://osgeo-org.1560.n6.nabble.com/tiled-vector-layer-td4554120.html
Great work! Thanks a lot!
Thanks, Hope its useful to you.
When using a base layer that has a projection other than 4326 it fails to calculate the tile coordinates. At least it failed with the 900913. Not sure it is the best approach, but at line 159 I changed it to take the resolution from the layer, not the map. Unlike the map, this layer is set to be 4326, so the resolution given by getResolution is the proper one and now it works fine with the OSM base layer.
this.resolution = this.layer.getResolution();
Instead of:
this.resolution = this.layer.map.getResolution();
Hi Mark,
Thanks for the bug fixing and posting the same here.
Gagan