Custom drawing on globe surface

813 views
Skip to first unread message

shar...@gmail.com

unread,
Mar 17, 2015, 2:39:58 PM3/17/15
to cesiu...@googlegroups.com
Hi, I would like to know, can i use some webgl code for drawing on earth globe surface?
Something like this:
var ctx = this.canvas.getContext('2d');
var g = ctx.createRadialGradient(x, y, 0, x, y, radius);
var a = 1 / 10;
g.addColorStop(0, 'rgba(255,255,255,' + a + ')');
g.addColorStop(1, 'rgba(255,255,255,0)');
ctx.fillStyle = g;
ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);

Matthew Amato

unread,
Mar 17, 2015, 2:51:56 PM3/17/15
to cesiu...@googlegroups.com
It depends on what you want to do.  If you want to draw lines/polygons/shapes on the earth surface, you can do that using the Entity API, see this tutorial

If you want to draw custom imagery on a per-tile basis, then you want a custom imagery provider, but I'm guessing that's not what you want.

You might also be interested in this example for interactive drawing.  Code is available here: https://github.com/AnalyticalGraphicsInc/cesium-google-earth-examples


--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

shar...@gmail.com

unread,
Mar 17, 2015, 4:12:06 PM3/17/15
to cesiu...@googlegroups.com
вторник, 17 марта 2015 г., 21:51:56 UTC+3 пользователь Matthew Amato написал:
Thanks for reply. I just want add simple heatmap API for CesiumJS. As I understand it, this can't be done with entities.

Matthew Amato

unread,
Mar 17, 2015, 4:16:13 PM3/17/15
to cesiu...@googlegroups.com
If all you are doing is generating an image and drawing it on the globe, you can absolutely do it with entities by using a polygon or rectangle and assigning the material the generated canvas.  I've actually been meaning to prototype something like that with heatmap.js for a while.

shar...@gmail.com

unread,
Mar 18, 2015, 5:01:23 AM3/18/15
to cesiu...@googlegroups.com
So, how can i get canvas context and globe surface for drawing circle entities with radial gradient?

Matthew Amato

unread,
Mar 18, 2015, 11:26:56 AM3/18/15
to cesiu...@googlegroups.com
Sounds like you want to create your own imagery provider, I just responded to a similar question in this thread: https://groups.google.com/d/msg/cesium-dev/o_b3m-gHAZA/tWSkma3syHMJ

If that's not what you want, you can just create a canvas out of this air, draw on it, and then assign it as the material for any polygon you want, which is discussed in the tutorial I previously linked to up thread.

On Wed, Mar 18, 2015 at 5:01 AM, <shar...@gmail.com> wrote:
So, how can i get canvas context and globe surface for drawing circle entities with radial gradient?

shar...@gmail.com

unread,
Mar 24, 2015, 3:10:23 PM3/24/15
to cesiu...@googlegroups.com
Yes, i did my own ImageryProvider. How can i add my class to cesium or rebuild cesium.js with my sources?

Matthew Amato

unread,
Mar 25, 2015, 8:10:28 PM3/25/15
to cesiu...@googlegroups.com
There's no need to rebuild Cesium unless you are working on a standard implementation that you want to submit back to Cesium.  You just include your imagery provider with the rest of your application code.

On Tue, Mar 24, 2015 at 3:10 PM, <shar...@gmail.com> wrote:
Yes, i did my own ImageryProvider. How can i add my class to cesium or rebuild cesium.js with my sources?

shar...@gmail.com

unread,
Mar 26, 2015, 5:47:29 AM3/26/15
to cesiu...@googlegroups.com
четверг, 26 марта 2015 г., 3:10:28 UTC+3 пользователь Matthew Amato написал:
I get "Uncaught SyntaxError: Unexpected token . index.html:1" when i include my imagery provider.

index.html code: http://pastebin.com/f0su8wfM

HeatmapImageryProvider.js code: http://pastebin.com/PpRJbR4e

What i'm doing wrong?
Reply all
Reply to author
Forward
0 new messages