{"id":1509,"date":"2015-11-18T04:32:18","date_gmt":"2015-11-18T04:32:18","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1509"},"modified":"2015-11-18T04:32:18","modified_gmt":"2015-11-18T04:32:18","slug":"cesiumjs-how-to-get-the-positions-of-the-polyline-from-a-pick","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2015\/11\/cesiumjs-how-to-get-the-positions-of-the-polyline-from-a-pick\/","title":{"rendered":"cesiumjs &#8211; How to get the positions of the polyline from a pick ?"},"content":{"rendered":"<pre>\r\nvar handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);\r\nhandler.setInputAction(function(click) {\r\n    var pickedObject = viewer.scene.pick(click.position);\r\n    \r\n    if (Cesium.defined(pickedObject) && (pickedObject.id)) {\r\n        console.log(pickedObject.id.polyline.positions.getValue(viewer.clock.currentTime));\r\n    }\r\n}, Cesium.ScreenSpaceEventType.LEFT_CLICK);\r\n<\/pre>\n<p>To set the positions to a new value, you can do <\/p>\n<pre>\r\npickedObjects.id.polyline.positions = Cesium.Cartesain3.fromDegreesArray([lat, lon, lat, lon,...);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); handler.setInputAction(function(click) { var pickedObject = viewer.scene.pick(click.position); if (Cesium.defined(pickedObject) &#038;&#038; (pickedObject.id)) { console.log(pickedObject.id.polyline.positions.getValue(viewer.clock.currentTime)); } }, Cesium.ScreenSpaceEventType.LEFT_CLICK); To set the positions to a new value, you can do pickedObjects.id.polyline.positions = Cesium.Cartesain3.fromDegreesArray([lat, lon, lat, lon,&#8230;);<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[53,27],"tags":[],"class_list":["post-1509","post","type-post","status-publish","format-standard","hentry","category-cesiumjs","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=1509"}],"version-history":[{"count":1,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1509\/revisions"}],"predecessor-version":[{"id":1510,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1509\/revisions\/1510"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}