I am trying to make a export control to export the map as image file.
I found this example:
http://dev.openlayers.org/sandbox/camptocamp/canvas/openlayers/examples/exportMapCanvas.html
so i added the control to the map and the function
function exportMap() {
var canvas = OpenLayers.Util.getElement("exportedImage");
exportMapControl.trigger(canvas);
}
I also added the ExportMap.js file:
http://dev.openlayers.org/sandbox/camptocamp/canvas/openlayers/lib/OpenLayers/Control/ExportMap.js
but, i am getting this error, when i am trying to run exportMap():
Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': No function was found that matched the signature provided. ExportMap.js:128
What that mean? how can i fix it?
Best Answer
You have to set
useCanvas
property for every layer you want to export with ExportMap.js.See this example and its source code: Export map as image
I have successfully exported
WMS
,WFS
andVector
layers but can't exportGoogle Maps layer
. If you can exportGoogle Maps layer
then let me know that.