[OpenLayers-Users] export map issues

Eric Lemoine eric.lemoine at camptocamp.com
Thu Aug 12 13:26:06 EDT 2010


On Thursday, August 12, 2010, DevHour <jamie at devhour.net> wrote:
> Currently I am trying to export maps to a canvas element by using the example posted at http://trac.openlayers.org/browser/sandbox/camptocamp/canvas/openlayers/examples/exportMapCanvas.html  by tsauerwein. So far i've grabbed that html file and the exportMap.js file. The issue i'm having is that it won't export the WMS layers, although it will export vector layers.
>
> I've gone through and tried to debug the script (using Firebug) and this is the part where its failing:
>
> ExportMap.js - line 128 through 136
> exportGridLayer: function(layer) {
>         if (layer.useCanvas != OpenLayers.Layer.Grid.ONECANVASPERLAYER) {
>             return;
>         }
>
>         if (layer.canvas != null) {
>             this.drawLayer(layer.canvas);
>         }
>     },
>
> Now it is passing the layer correctly into the function but layer.useCanvas is undefined. So it'll automatically pass over that first if statement, and also layer.canvas is also undefined there so it'll pass over the next if statement as well. Meaning that the layer won't get passed through to the draw canvas. Like I said it works for vectors, just not the others. Is there any reason why these 2 properties (useCanvas and canvas) are both undefined? am I missing a reference to something?
>
> Any help I get will be greatly appreciated!


This sandbox also includes code for displaying tiles using canvas. And
it looks like only WMS layers that use canvas with the
ONECANVASPERLAYER mode can be exported.


Hope it helps,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list