how to get exact point location of a point cloud data

754 views
Skip to first unread message

ashbira...@gmail.com

unread,
Jul 18, 2018, 6:04:25 AM7/18/18
to cesium-dev
I want to pick the exact point location. i.e exact lat long value of particular point in a point cloud data on mouse click.

can someone help me out in partial code example.

Omar Shehata

unread,
Jul 19, 2018, 2:52:49 PM7/19/18
to cesium-dev
You should just be able to use viewer.scene.pickPosition

So you'd use it like:

// Pick position of individual points 
var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function(event) {
    var position = viewer.scene.pickPosition(event.position);
    // position will be undefined if the user clicks something off the globe
    if (Cesium.defined(position)) {
        console.log(position);
    }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

Here's a running Sandcastle example.

This will give you a cartesian position. You can then convert that to a long/lat.

Abe

unread,
Apr 26, 2019, 9:42:23 PM4/26/19
to cesium-dev
Pickposition wont give you the exact location. Has anyone achieved this?

Omar Shehata

unread,
Apr 29, 2019, 12:32:53 PM4/29/19
to cesium-dev
Can you elaborate on what you mean? Do you have a code example or a Sandcastle (https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/) where it's producing an incorrect result?

Abe

unread,
May 21, 2019, 12:47:34 AM5/21/19
to cesium-dev
Hi Omar,

pickPosition gives you the position based on the depth buffer on the 2D screen. If you use that position to graph a sphere for example and zoom in, you can see the position computed using pickPosition is not the same as the position of the point that was clicked. I am looking to for a way to pick the exact position of a point clicked

Omar Shehata

unread,
May 21, 2019, 12:33:42 PM5/21/19
to cesium-dev
Hey Abe,

Can you please show me how you're testing this? I tried this test you suggested, and I am seeing a sphere in exactly the location I clicked on. Here's a Sandcastle of this zoomed in on the grand canyon to make it easier to test. Below is an animation of clicking at a couple locations to show how pickPosition returns an accurate result.

pickPosition_optimized.gif


Are you seeing different behavior in this code example?

Omar Shehata

unread,
May 21, 2019, 12:34:41 PM5/21/19
to cesium-dev
Here's the animation on imgur if it's not playing in this forum post: https://imgur.com/qid4WTS
Message has been deleted
Message has been deleted

satten...@datalive.com.au

unread,
Jun 13, 2019, 1:14:51 AM6/13/19
to cesium-dev

Yes we have the same issue. Our solution was to use a spatialite database to do a spatial query on the point cloud as this was able to bypass the screen-space inaccuracies and the fact that there's no GPU-CPU transfer of point cloud data. Obviously not ideal for many reasons, but it enabled us to show details for the exact location of a point.

Omar, it's the definition of "exact" that's the issue. The buffer will get *very* close, but when dealing with point clouds with an accuracy of 1/10mm, the buffer isn't good enough. Plus it sometimes gives wildly inaccurate values if you're on the very edge of a point (in the order of hundreds of metres inaccurate).

Omar Shehata

unread,
Jun 14, 2019, 11:17:32 AM6/14/19
to cesium-dev
Stuart, thanks for the explanation and posting your current workaround. I see what you mean now. I posted some thoughts in this forum thread on what it would take to get 3D Tiles to save the points on the CPU and do this kind of spatial query:


It looks like we might be prioritizing this soon. I'll definitely update these thread(s) when there's progress on it, but I'd also keep an eye on the GitHub/monthly releases.

Abe

unread,
Jun 17, 2019, 3:26:51 PM6/17/19
to cesium-dev
Stuart, Omar, this is what makes a pickPosition based tool for point clouds the hardest  " Plus it sometimes gives wildly inaccurate values if you're on the very edge of a point (in the order of hundreds of metres inaccurate)." Any idea how to fix this? Thank you!

Omar Shehata

unread,
Jun 20, 2019, 5:44:11 PM6/20/19
to cesium-dev
I appreciate the explanation Abe. I think the solution here would be to save the per-point x/y/z on the CPU and allow retrieving them on click, in the same way the "3D Tiles interactivity" demo on Sandcastle allows you to retrieve building height/specific metadata for each building on click. 

I've opened a feature request here along with some implementation notes from Sean:


Hopefully we'll get a chance to implement this soon.
Reply all
Reply to author
Forward
0 new messages