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:
// Create a raster elevation source based on all files in dted1Files
RasterElevationSource dted1ElevSource = new RasterElevationSource(Dted1Files);
await dted1ElevSource.LoadAsync();
dted1ElevSource.Name = "DTED1";
// Create a Surface based on the elevation source
Dted1Surface.ElevationSources.Add(dted1ElevSource);
Dted1Surface.Name = "DTED1 Surface";
await Dted1Surface.LoadAsync();
// Create a Scene and assign the created surface to its BaseSurface
Scene dted1Scene = new Scene();
dted1Scene.BaseSurface = Dted1Surface;
await dted1Scene.LoadAsync();
// Create a SceneView and assign created scene to its Scene
SceneView1.Scene = dted1Scene;
Then I can get elevation at any particular point via:
result = await Dted1Surface.GetElevationAsync(point);
I tried this, but the Z values are all zero:
var drapedOverlay = new GraphicsOverlay();
drapedOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Draped;
SceneView1.GraphicsOverlays.Add(drapedOverlay);
// existing polyline on a map layervar
var hose = hoselineLayer.Graphics.FirstOrDefault();
hose3d = new Graphic(hose.Geometry);
drapedOverlay.Graphics.Add(hose3d);
Try changing the SurfacePlacement to "Absolute"; and you will need to convert your polyline from 2D to 3D using something like:
```
```
You might also need to use "GeometryEngine.Densify()" to get more accurate 3D representation of the elevation.
I gave this code a simple test and seems to work; might need more testing.
Do you know what the units are on the maxSegmentLength parameter for Densify?
For this method, the maxSegmentLength parameter would have the same units as the geometry's spatial reference system
Heads up that this line has an error:
for (int i = 0; i < geom.Parts[0].Points.Count - 1; i++)
it should not have the -1:
for (int i = 0; i < geom.Parts[0].Points.Count; i++)