Working with .NET Runtime v100.0 and a WPF desktop application ... I'd like to be able to draw an elevation profile that corresponds to a graphic that I've drawn on a map. Additionally, I'd like to inspect the line to find the elevation at any point along the line. Any help for these two items would be appreciated.
Here is what I have so far:
<SPAN class="comment token">// Create a raster elevation source based on all files in dted1Files</SPAN>
RasterElevationSource dted1ElevSource <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">RasterElevationSource</SPAN><SPAN class="punctuation token">(</SPAN>Dted1Files<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">await</SPAN> dted1ElevSource<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LoadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
dted1ElevSource<SPAN class="punctuation token">.</SPAN>Name <SPAN class="operator token">=</SPAN> <SPAN class="string token">"DTED1"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create a Surface based on the elevation source</SPAN>
Dted1Surface<SPAN class="punctuation token">.</SPAN>ElevationSources<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN>dted1ElevSource<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
Dted1Surface<SPAN class="punctuation token">.</SPAN>Name <SPAN class="operator token">=</SPAN> <SPAN class="string token">"DTED1 Surface"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">await</SPAN> Dted1Surface<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LoadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create a Scene and assign the created surface to its BaseSurface</SPAN>
Scene dted1Scene <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Scene</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
dted1Scene<SPAN class="punctuation token">.</SPAN>BaseSurface <SPAN class="operator token">=</SPAN> Dted1Surface<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">await</SPAN> dted1Scene<SPAN class="punctuation token">.</SPAN><SPAN class="token function">LoadAsync</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// Create a SceneView and assign created scene to its Scene</SPAN>
SceneView1<SPAN class="punctuation token">.</SPAN>Scene <SPAN class="operator token">=</SPAN> dted1Scene<SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Then I can get elevation at any particular point via:
result <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> Dted1Surface<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetElevationAsync</SPAN><SPAN class="punctuation token">(</SPAN>point<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
I tried this, but the Z values are all zero:
<SPAN class="keyword token">var</SPAN> drapedOverlay <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GraphicsOverlay</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
drapedOverlay<SPAN class="punctuation token">.</SPAN>SceneProperties<SPAN class="punctuation token">.</SPAN>SurfacePlacement <SPAN class="operator token">=</SPAN> SurfacePlacement<SPAN class="punctuation token">.</SPAN>Draped<SPAN class="punctuation token">;</SPAN>
SceneView1<SPAN class="punctuation token">.</SPAN>GraphicsOverlays<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN>drapedOverlay<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// existing polyline on a map layervar</SPAN>
<SPAN class="keyword token">var</SPAN> hose <SPAN class="operator token">=</SPAN> hoselineLayer<SPAN class="punctuation token">.</SPAN>Graphics<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FirstOrDefault</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
hose3d <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Graphic</SPAN><SPAN class="punctuation token">(</SPAN>hose<SPAN class="punctuation token">.</SPAN>Geometry<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
drapedOverlay<SPAN class="punctuation token">.</SPAN>Graphics<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN>hose3d<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>