Draw polygon with Cesium

1,694 views
Skip to first unread message

Jules d'As

unread,
Mar 11, 2016, 3:45:43 AM3/11/16
to cesium-dev
Hello,
Currently I use Cesium 1.19, I need to draw a polygon as a rectangle.

Until then, I can draw this polygon but using 4 points to place. (I click on the map and I recovered coordinated to draw this polygon as the figure below (Figure 1))
Now I ask you, if possible, of tutorial or code snippet showing a mouse movement polygon tracing (Figure2.swf.html)

Best,
Jules
Figure2.swf
Figure2.swf.html
Figure 1.png

Hannah Pinkos

unread,
Mar 11, 2016, 10:14:14 AM3/11/16
to cesium-dev
Hello Jules,

Instead of using a polygon, you might want to use our rectangle geometry type: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Rectangle.html&label=Geometries
For drawing, you will need define click event handlers to handle dragging.  Check out the code example in this forum post for dragging around a billboard to draw a wall: https://groups.google.com/forum/#!msg/cesium-dev/nypZFdPLjhs/rRH_NdUvhVIJ

We're currently working on putting together a blog post to demonstrate how to add drawing functionality to Cesium.  Keep an eye on the website for that.

Best,

Hannah
Reply all
Reply to author
Forward
0 new messages