[OpenLayers-Users] export map issues
DevHour
jamie at devhour.net
Thu Aug 12 17:24:03 EDT 2010
Eric Lemoine <eric.lemoine at camptocamp.com> wrote ..
> 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
>
Well currently i'm strictly using the code that was provided, including the html file. The WMS base layer that is provided looks like so;
var wmsBase = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0?",
// "proxy.cgi?url=http://labs.metacarta.com/wms/vmap0?",
{
layers: 'basic'
},
{
useCanvas: OpenLayers.Layer.Grid.ONECANVASPERLAYER
});
As you can see useCanvas is defined and set to ONECANVASPERLAYER. This is one of the reasons why i'm stuck, before useCanvas is defined yet still showing as undefined.
More information about the Users
mailing list