Following OpenLayers map printing demo here, I'm able to get my map in image format. But I'm facing two issues with the export:
- Google Street base map is not included in the image output;
- Whenever I activate any WMS layer, the export fails with the error
TypeMismatchError: The type of an object is incompatible with the expected type of the parameter associated to the object
To get an image output of the map, I'm using Canvas.toDataURL(), which opens another window with the image of my WFS layers. According to the demo, when using Canvas.toDataURL(), images should be requested through a proxy, a point I don't understand as far as Google base layer is concerned. Any clarification will be appreciated.
I'm not sure what I may be doing wrong. Below shows how I retrieve Google base map and WMS layers:
Google base map:
var gStreet = new OpenLayers.Layer.Google(
'Google Street',
{numZoomLevels: 19},
{visibility: true},
{isBaseLayer: true},
{useCanvas: OpenLayers.Layer.Grid.ONECANVASPERLAYER}
);
WMS Layer:
var wmsLayer = new OpenLayers.Layer.WMS("My WMS Layer",
GEOSERVER_HOST + "/wms",
{layers: "wms_layer", format: 'image/png'},
{
useCanvas: OpenLayers.Layer.Grid.ONECANVASPERLAYER,
isBaseLayer: false
}
);
GEOSERVER_HOST is proxied via Apache web server. I've configured Apache to channel all GeoServer requests as necessary. As such, I'm not making direct request to GeoServer in my client.
Any idea on what I may be doing wrong will be appreciated.