Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to take screenshot of map in CesiumJS?

I'm using CesuimJS (http://cesiumjs.org/) to present map. I want to take a screenshot of part of the map.

I tried using Three.js (http://learningthreejs.com/blog/2011/09/03/screenshot-in-javascript/) but failed to take a screenshot

Any ideas?

like image 592
Dor Cohen Avatar asked Jul 15 '15 10:07

Dor Cohen


1 Answers

There is no need to use ThreeJS.

You can use the canvas function toDataUrl.

viewer.render();
viewer.canvas.toDataUrl();

toDataUrl returns url that can be used to get the screenshot.

like image 150
idoshamun Avatar answered Oct 10 '22 02:10

idoshamun