http://trac.openlayers.org/ticket/1512 has this morning's project, a canvas-based Renderer for OpenLayers vector layers.
For comparison: * Canvas: http://crschmidt.net/mapping/choropleth-canvas.html * SVG: http://crschmidt.net/mapping/choropleth.html (If this isn't available, http://dev.openlayers.org/sandbox/crschmidt/canvas-renderer/examples/canvas-renderer.html is/should be.) In Firefox 2, there will probably be an obvious difference in rendering speed. (there is also an obvious difference in functionality: the former has no hover-select control, for performance reasons.) >From the ticket: ==== It implements feature selection by looping over its internal list of features, and doing intersection queries. Depending on the browser, this may or may not be reasonable. One thing that this behavior suggests is that the standard Feature Handler should perhaps be informed whether it is being used as a 'hover' handler: if it isn't, it shouldn't bother doing the (now somewhat expensive) getFeatureIdFromEvent check on mousemove as it currently does. For browsing somewhat static vector data, this Renderer is quite effective, especially for browsers where SVG support is less fast: FF2, for example, gets to be much more usable on whole-world country borders maps that are currently being tossed about. Includes support for stroke/fill width/color/opacity, externalGraphic, point/line/linearring/polygon and collections thereof. ==== I've tested it in Safari 3.1, FF2, and Opera 9.5 on Mac. (IE still falls back to the VML renderer in all situations so far as I'm aware.) I find the most difference in Firefox 2, where the large DOM created by the SVG document tends to make interacting with the map a painful process. Of note, the entire canvas redraws on zoom/dragend/etc., so there is a definite performance hit there, but even with 400 relatively complex features, it's only approximately a half second to redraw all of the polygons, which is pretty impressive, in my opinion. The code is avaialble in #1512, or in the canvas-renderer sandbox, if you're more comfortable with SVN than 'patch'. http://svn.openlayers.org/sandbox/crschmidt/canvas-renderer/ Feedback gladly accepted. Regards, -- Christopher Schmidt MetaCarta _______________________________________________ Dev mailing list [email protected] http://openlayers.org/mailman/listinfo/dev
