Export canvas map as jpeg image
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<tr>
|
||||
<th>DOM</th>
|
||||
<th>WebGL</th>
|
||||
<th>Canvas</th>
|
||||
<th>Canvas <a id="canvas-export" href="#" download="map.png">export map as png</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div id="domMap" class="map"></div></td>
|
||||
|
||||
@@ -48,3 +48,7 @@ var canvasMap = new ol.Map({
|
||||
});
|
||||
canvasMap.bindTo('layers', webglMap);
|
||||
canvasMap.bindTo('view', webglMap);
|
||||
|
||||
goog.events.listen(goog.dom.getElement('canvas-export'), 'click', function(e) {
|
||||
e.target.href = canvasMap.getRenderer().getCanvas().toDataURL();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user