Line of Sight Analysis Tool

Hi Dear Community,

I need a Line of Sight analysis tool like in ArcGIS Earth. Is it available in CesiumJS or Cesium ion?

Thank you!

not available.
you should make your own code.

@Hazel-Leylak

Welcome to the community! :grinning: :rocket:

While this functionality is not part of our CesiumJS API, a line of sight analysis tool is included with Cesium ion SDK. For more information on Cesium ion SDK, please check out the following website.

Here is a screenshot of our line of sight implementation taken from one of our common operating picture demos.

You can also check out our Cesium ion SDK API for more technical details.

https://cesium.com/learn/ion-sdk/ref-doc/

Please let me know if you have any other questions! I am happy to provide more information on Cesium ion SDK.

-Sam

1 Like

Hi, where can I find a code example for using this feature in cesium-ion?

Have you find an example ?

Has anyone found the example?

There currently is no official functionality for Line Of Sight analysis in CesiumJS itself. However, there are a few options for how something like this could be implemented.

I’ll have to start with a disclaimer:

What I’m describing here is using a private API of CesiumJS. There are no guarantees for this part of the API. It may change, without notice, between releases.

And then I’ll have to update the following accordingly :slightly_smiling_face:


General considerations

Some details of such a Line-Of-Sight analysis may depend on the exact application case.

API

One could say that there are different questions that may be part of such an analysis:

  • Is there a line of sight between two given points?
  • What is the point of the geometry that someone sees when standing at a certain position and looking in a certain direction?
  • Which are the (“all”!) points that can be seen from a certain position?
  • … (+ probably different flavors of that)

Fortunately, most of that can be achieved or emulated with a function that receives a “picking ray” (with an origin (3D point) and a direction (3D vector)), and returns a “result” that encapsulates whether any geometry was hit by that ray (and where it was hit).

Precision

An important consideration for implementing such a functionality in CesiumJS is: Based on which geometry should these computations be performed?

CesiumJS is usually loading the data as 3D Tiles. And 3D Tiles is tailored for streaming different levels of detail. It might be that a certain line of sight does exist for a low level of detail, but when more detail is loaded, then the new geometry interrupts that line of sight. (Conversely, the higher detail may cause new lines of sight to exist that didn’t exist for the lower detail).

Implementation in CesiumJS

At the time of writing this, there exist functions in CesiumJS that can be used for performing line-of-sight computations. These are

Both of these functions are marked as @private!

They should usually not be called by clients. They may change between releases, without deprecation periods. Use them at your own risk.


The following is a Sandcastle that shows two different ways of performing line-of-sight computations, using both of these functions. A short screencap of that Sandcastle:

Cesium LineOfSight Example 0001

It offers a button to perform line-of-sight computations based on the most detailed representation of the tileset. This may be slow, and is done asynchronously.

Alternatively, left-clicking the mouse performs a line-of-sight computation based on the geometry that is currently visible (which is much faster).

The sandcastle is pretty large, but … don’t be scared: Only a tiny fraction is doing the actual Line-Of-Sight computation. The remaining part is for presenting it nicely :slight_smile: Most of the functions are used for the visualization of the results. All of the functions carry short comments. The main functions for the line of sight computations are

  • computeVisibilityResultSimple
  • computeVisibilityResultMostDetailed

reflecting the pickFromRay/pickFromRayMostDetailed functions that are used for the computations.

https://sandcastle.cesium.com/index.html#c=7RsLU9tG+q9suM5UTowwhCTUkE4JOKmnBDjspNc7btq1tLb3ImtVaQW4Kf/9vn2vHsaQSaePaSYJWNrv/dxv1xFLC46uKLkmOXqJUnKNjkhBy0X4Xj4LLjci+fmIpRzTlOSXG539y1RBhEVEUhImbIZzyucLGh2TjM9fldOpRDfFSUFg9WW6tfXyM/4R+NC3JMmAyrRMI05BDDRlOeJzAtIUJU7oL1g8VsTREVtkJSfyfc64fIUCXCCMdm920QLznN504DXmaA6POUMTgnCWJZTEEgM8+VJA/7KJb2jxJQpoSEKEU8Qm/yMRV6BAdpaSGF2DNpBb3ZEYCqYWUfhbNJcmoF0gyq8JSeWDGb2C3zJWUCnfZWpERZGS5lCgWJCUX2iJArO417Vw2x308TJFACMsHVNhGpJGBMyjLX2Ecw6/4fRpWJQTnuOIBwICORzd6uee/uy5i0MSdMRL4SSGqFBBK7koZ0WhaTXfvjsdjn/8tyblGH847ROSzkDJbRws8CylvIxJIO0kAekUBR7YgQF7i/k8HJyPhidnp8+1VhHKCS/z1FsDjrQbDo8Hp+Ph+AeJ8NZjJ50l5ALHrczIl6+UBzxUK3W5jZP/s8Sc5KnwGkvSPQunOVscgqyHgrSmKWTX+A27TZ07HE2dG9pKGY6uUY4gOs5xWiQ1Fo0fjyJsuWm3cy8EFzf/dTR7TZnv9JVtAW7+6zSXanZ9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