Map export to openLayers

I am trying to export a 2.13.1 openLayers map to a canvas, but the methods for this seem to have disappeared.

Old methods will work as follows:

var exportMapControl = new OpenLayers.Control.ExportMap();
map.addControl(exportMapControl);

var canvas = OpenLayers.Util.getElement("exportedImage");
exportMapControl.trigger(canvas);   

Does anyone know how this works for 2.13.1?

Thanks in advance,

+3
source share
2 answers

I will not write the whole function here (as it is already on the two sites of the stack), but this solution using html2canvas allows you to export dataURL for your OpenLayers 2 .

In my application - I then use dataURL to add the map to pdf using jsPDF .

WMS, vector and base layers are exported in this solution.

OL3 , - toBlob OL3.

0

ExportMap OpenLayers ( , , github ). - , , , ().

. OL 2.13.1, OpenLayers.Control.ExportMap . - OL , , .

+2
source

All Articles