A pretty common scenario for me is to have an aircraft where I have an azimuth and elevation from the aircraft, and I'd like to know where the vector originating at the aircraft and proceeding along the given az/el would intersect the ground. For example, let's say it's a camera, I'd like to know the MapPoint where the center of its view hits the ground. Similar to how a viewshed works, but I want to know in code where that center point is.
I can query the elevation of several points around where the vector might intersect, but it would be better if the engine could tell me where the intersection point would be. Obviously given the way viewsheds work, the engine can do this calculation. However, I'm not clear on how I could request the intersection point of a vector with the ground.
Is there a way to query this? I'd like to give a point in space, then give an az/el or RPY or even quaternions if necessary representing where the view/beam is going, and get a MapPoint representing where the intersection of that point would be with the ground.
Is there a tool that can give me the intersection point? If I were to configure a viewshed with my parameters, is there a way to know where the center point of its view is? I'd really like to be able to do this because it's a common case for me and it would have many applications. Thanks.
The only way I'm aware to do this is to query this is from the current view - ie you'd have to place the camera at the position of the aircraft, then the SceneView.ScreenToLocationAsync method would tell you the precise location. You could build a camera that looks exactly in that direction,and you'd then use the center of the screen as the input (ie half the width/height of the view).
That's a good idea. Is there a way for me to create a SceneView in the background which isn't visualized and use that to make the calculation? Would it still work if I created it and added the same elevations basemaps but didn't display it?
I'd like the user to be able to move the camera around but also check that value at the same time. It's a bit roundabout but it's fine as long as it works.
Might it be possible to expose the Viewshed's center point and Extent/polygon of MapPoints at some point in the future, or provide a tool to tell me where the intersection would happen if I were to start a Point X and proceed along a given az/el?
Hopefully you can see the difficulty. I can check different elevation sources, but I'd like to know where the intersection of that vector would be, taking elevation into account. It's hard for me to do anything other than query a whole bunch of elevation points in an area, and my calculations wouldn't be sophisticated enough to know if I intersected with a hill that was in the way or something like that, and I would worry about not being able to query enough elevation data points fast enough to be accurate.
Thanks for your help!
> Is there a way for me to create a SceneView in the background which isn't visualized
Not really. The calculations are done based on what is currently rendering.
> Would it still work if I created it and added the same elevations basemaps but didn't display it?
No, would have to be a clone.
> Might it be possible to expose the Viewshed's center point and Extent/polygon of MapPoints at some point in the future,
It's actually all done on the GPU using shaders, so there aren't actually any points or polygons to even pull out.
While there are ways to pull the elevation at a specific location (equivalent to a straight-down vector intersection), there aren't really any intersection-test APIs for querying along any arbitrary vector at this point.
Thanks so much for the info.
Is there an example of a picture-in-picture type of effect? Maybe I can create a picture-in-picture view that shows what the camera sees and make that a "bonus feature" that will also allow me to get the points.
Can I link another SceneView to the first so that they share all the objects? Or can I reuse the same objects in two SceneViews? Or would I have to create new copies of all my objects to create the same view?