I'm trying to export an 2.13.1 openLayers map into a canvas, but the methods to do so seem to have vanished.
The old methods would work like:
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,
The ExportMap control was actually never a part of the official OpenLayers distribution (you can confirm that by checking out the project on github and browsing history). The example above comes from a sandbox that seems to be a user-submitted enhancement proposal (demo here).
The source of this custom control is available HERE.
Simply import it after loading OL 2.13.1 and it should be available as OpenLayers.Control.ExportMap again. Unless some other part of OL it depends on changed in the meantime it should work as it used to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With