Offset to Observer Height with Line of Sight Widget?

850
6
07-17-2020 09:45 AM
JasonJordan00
Occasional Contributor

Is it possible when a user interactively sets a observer position with the line of sight widget to add a vertical offset? For instance if the observer was 6 ft tall?

0 Kudos
6 Replies
JethroLeevers
Occasional Contributor

Adding a bump to this question

Is this on the roadmap for the ArcGIS Javascript API in the near future?

A vertical offset for the targets would be great too.

As a use case:

Determining if a fence is a sufficient height

0 Kudos
RalucaNicola1
Esri Contributor

Sorry for the late reply. This is currently not possible out of the box and it is not on our road map. 

Thinking about it, it should be possible to watch for updates on the observer and offsetting it. There is a risk in running into an infinite loop, that's why I am removing the watcher when I set the observer with the new height. Also the user experience is not so nice if I offset the observer right after the user changes it, so I am waiting for the user to not interact with the view anymore. And to catch also the case when a user places an observer for the first time (the view is interacting in that case), I am also checking whether the change in value was from null to a new value.

Long story short, here is the code: https://codepen.io/nicolaraluk/pen/wvGRxPE?editors=1000 

Jason JordanJethro Leevers‌, let me know if this helps.

JethroLeevers
Occasional Contributor

Thanks Raluca,

Not the ideal solution but I can live with a work around for now.

Would be great to see it on the roadmap in the future.

0 Kudos
RalucaNicola1
Esri Contributor

I'll pass the request on to the team Jethro  let me know also if you have more use cases or specific requirements.

0 Kudos
JethroLeevers
Occasional Contributor

This method no longer works in the latest (4.25) release, the observer value has a value of 0 for z when over ground/terrain (It works fine on mesh or model surfaces)

0 Kudos
GreteSoosalu
Esri Contributor

Hi @JethroLeevers 

You can still use the same method but since the API version 4.23 it is not necessary to call viewModel.start() and viewModel.stop() anymore (part of a bug fix shipped with 4.23, see release notes or the Line of Sight widget sample).

So if you remove that part, the old sample app with the workaround will function again. 

(cross-posting)

0 Kudos