Is there a way to drape overlay geometries over elevation surface?

2503
6
03-10-2020 01:52 PM
Justin_ODell
New Contributor III

When one is adding geometry (particularly polygon or line, optionally point) overlays (example in ProSnippets: Graphic Overlay ) to a scene they often get obscured by the elevation surface. Is there a way to drape overlay geometries over elevation surface, like it does when added as a feature to a layer (see "2D layers (drawn on a surface)" examples from Operational Layers) ?

Thanks much!

(Somewhat related to How to build a 3D Marker symbol display on a scene)

Tags (2)
0 Kudos
6 Replies
UmaHarano
Esri Regular Contributor

Hi Justin,

Graphic overlays cannot be draped over the elevation surface. 

Thanks

Uma

0 Kudos
Justin_ODell
New Contributor III

Thanks Uma!

I'm sorry to hear that. Hopefully in a future version...


For now, do you have any other suggestions for how to keep temporary (like overlay) 2D lines/polygons visible when drawn in a scene with an elevation surface?

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Justin,

 I think Uma is correct as there is no direct method to do this, however, you can look at this method: GetZsFromSurfaceAsync as a workaround. This method takes your geometry and sets the Z values to elevation surface Zs.  You can then add the output 3D geometry to as an overlay graphic.  I will add a sample to community samples that will do this.  Hopefully later today... 

- Wolf

Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Justin,

 I managed to get points and lines to work so far.   Points are straight forward (just call GetZsFromSurfaceAsync using the point geometry), but for lines, the trick for the workaround is to 'densify' the polyline before you pass the geometry to GetZsFromSurfaceAsync.  This way each vertex will be elevated to the proper Z value.  Below is the snippet i used in my test tool:

    protected async override Task<bool> OnSketchCompleteAsync(Geometry geometry)
    {        
      var polyline = geometry as Polyline;
      if (polyline != null)
      {
        var sR = polyline.SpatialReference;
        // make more vertices ... using tolerance to cover projected / non-projected coord systems
        var denseDistance = sR.XYTolerance * 1000;
        var denseLine = GeometryEngine.Instance.DensifyByLength(polyline, denseDistance) as Polyline;
        var result = await ActiveMapView.Map.GetZsFromSurfaceAsync(denseLine);
        if (result.Status == SurfaceZsResultStatus.Ok)
        {
          _ = QueuedTask.Run(() =>
          {
            var movedZup = GeometryEngine.Instance.Move(result.Geometry, 0, 0, 1) as Polyline;
            ActiveMapView.AddOverlay(Module1.MakeCIMLineGraphic(movedZup));
          });
        }
      }
      return true;
    }
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Depending on the resolution of your surface you might have to elevate the line above the surface because Pro might obscure parts of the lines when you zoom out.  Below is a screenshot of my test where i placed first two points (the Pushpins) and then a line between those two points (i only digitized the start & end points):

As i mentioned above once you zoom in the line will not be obscured any more.  Below a screen shot of the line's left end viewed from the opposite side:

i haven't figured out the polygon 'draping' yet, but i will finish that and the sample next week.

- Wolf

Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Justin,

 i managed to get the 'draping' of polygons to work as well, however, i ran into a few issues.  I will try to publish my sample on ArcGIS Pro SDK Community Samples tomorrow, but in essence the algorithm works like this: i take the polygon to create a 'fishnet mesh' from which i then create a [triangle] MultiPatch geometry.  Finally I pass the MultiPatch geometry to GetZsFromSurfaceAsync in order to get the elevation for all MultiPatch nodes set to the proper elevation value.  Quite some work for a workaround, but the result looks like this:

 

Wolf
by Esri Regular Contributor
Esri Regular Contributor

I posted a new sample that illustrates a 'draping' on ground surface solution for polygons:

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/OverlayGroundSu...

0 Kudos