{"id":1482,"date":"2015-10-25T03:47:52","date_gmt":"2015-10-25T03:47:52","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1482"},"modified":"2015-10-25T04:09:26","modified_gmt":"2015-10-25T04:09:26","slug":"cesiumjs-how-to-get-the-the-coordinate-of-a-kml-point-2","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2015\/10\/cesiumjs-how-to-get-the-the-coordinate-of-a-kml-point-2\/","title":{"rendered":"Cesiumjs &#8211; How to get the the coordinate of a KML point ?"},"content":{"rendered":"<p><a href=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-coordinate-of-a-KML-point.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-coordinate-of-a-KML-point.png\" alt=\"phpmind-cesiumjs-coordinate-of-a-KML-point\" width=\"401\" height=\"349\" class=\"aligncenter size-full wp-image-1483\" srcset=\"https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-coordinate-of-a-KML-point.png 401w, https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-coordinate-of-a-KML-point-300x261.png 300w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/a><\/p>\n<p>Here is an event handler that will get the Cartesian3 position of a point on left click and writes it to the console. <\/p>\n<pre>\r\n            var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);\r\n        handler.setInputAction(function(click) {\r\n            var pickedObject = viewer.scene.pick(click.position);\r\n            if (Cesium.defined(pickedObject)) {\r\n                console.log(pickedObject.id.position.getValue(viewer.clock.currentTime));\r\n            }\r\n        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);\r\n    \r\n\/\/ Output for example\r\n\/\/ (-1506927.5843447673, -5174505.091726597, 3399472.531280526)\r\n\/\/ (-1704963.9958314616, -4665566.981540714, 3987362.8409044705)\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is an event handler that will get the Cartesian3 position of a point on left click and writes it to the console. var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); handler.setInputAction(function(click) { var pickedObject = viewer.scene.pick(click.position); if (Cesium.defined(pickedObject)) { console.log(pickedObject.id.position.getValue(viewer.clock.currentTime)); } }, Cesium.ScreenSpaceEventType.LEFT_CLICK); \/\/ Output for example \/\/ (-1506927.5843447673, -5174505.091726597, 3399472.531280526) \/\/ (-1704963.9958314616, -4665566.981540714, 3987362.8409044705)<\/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-1482","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\/1482","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=1482"}],"version-history":[{"count":4,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1482\/revisions"}],"predecessor-version":[{"id":1487,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1482\/revisions\/1487"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}