JSAPI 4 - 3D Visualization relative to ground/elevation

1485
7
06-04-2021 10:01 AM
Arne_Gelfert
Occasional Contributor III

Trying to visualize some subsurface polyline features in 3D. Created a Scene in Pro and published to Portal/Server. Then using JSAPI 4.18 to display.

The following plots my polylines.

const my3DLinesLayer = new FeatureLayer({
   url : 'my 3d URL',
   elevationInfo : {
      mode: 'relative-to-scene',
   },
   renderer : myRenderer
});

But so do:

mode : 'absolute-height'


and

mode : 'relative-to-ground'

 

What am I missing when it comes to the difference between "relative-to..." and "absolute..."?

In each case, my lines plot starting above ground and then continuing into subsurface. Since the line's starting point has a Z > 0, say Z = 1000, it looks like it get plotted starting 1000 units above ground. But the Z = 1000 should really be interpreted as starting at ground where ground = 1000 because these are absolute elevations.

So I can understand that 'relative-to-surface' or 'relative-to-ground' would work as described above - we're taking positive values for Z and plotting them above the ground and negative Z below - but why 'absolute-height'? Doesn't the ground elevation layer plot in relation to some approximation of sea level? So if ground is 1000 units above sea level, that's where my line-Z should be?

This is what I have in my map right now:

const map = new Map({
   basemap: "satellite",
   ground: "world-elevation",
   fadeOnZoom: true,
   force3DTransforms: true,
   navigationMode: "classic"
});

 

Thanks for any suggestions you may have. I'm new to 3D in web mapping, so I may not be missing something obvious.

@RalucaNicola - tagging you here since I've seen some great feedback from you in other threads. 😊

0 Kudos
7 Replies
Tim_McGinnes
Occasional Contributor III

There is an interactive sample which shows how the various modes work:

https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/ 

elevation-info

0 Kudos
Arne_Gelfert
Occasional Contributor III

@Tim_McGinnesThanks, Tim. Of course, I looked at that page and the observations I made were based on the different value for elevationInfo provided on that page. I've also since played with trying to use expressions but as soon as I do something as simple as :

featureExpressionInfo: {
    expression: "Geometry($feature).z * 2"
}

the feature appear flat, draped across the ground.

0 Kudos
Tim_McGinnes
Occasional Contributor III

Is it possible to provide a more complete code extract and a screenshot showing your actual problem? I’m not really sure on what you’re trying to do.

0 Kudos
Arne_Gelfert
Occasional Contributor III

Thanks, for chiming in, Tim.

So, say I have a 3D polyline that starts at XY and has Z = 1000 (as in 1000ft above MSL), and it has an endpoint of XY with Z = -1000, 1000ft below MSL. With the following settings in ArcGIS Pro:

Arne_Gelfert_0-1623178227503.png

This line plots entirely below the surface where elevation is at 1000' MSL. Great. just what I want.

After publishing this to ArcGIS Server and adding as FeatureLayer to webmap, I am unable to get it to plot as in Pro.  No matter what settings I try in elevationInfo, the feature will always start 1000' above the surface (ground) and extend to 1000' below surface. So everything is relative not to MSL but ground.

So maybe I need to define ground differently? I've looked at the documentation and haven't found anything.

0 Kudos
Tim_McGinnes
Occasional Contributor III

It's not a feet\metres problem is it? I see you are using the World Elevation Surface which I believe is in metres. What horizontal and vertical coordinate systems are you using? Maybe check out the HeightModelInfo parameter on the WebScene in the JSAPI.

ArcGIS Pro can probably handle feature layers with different units and display them in the right place, but I think ArcGIS Online can't. Sorry, but it's a bit hard knowing what's happening without seeing the actual data\code.

0 Kudos
Arne_Gelfert
Occasional Contributor III

I thought about the feet/meters thing as well and turns out that my source data actually has Z in meters. But after looking at the documentation again, I realize the "units" parameters in elevationInfo has not effect on Z.

I also found that using the offset = -1000 works and forces all lines down by 1000 units. But that's not really what I need.  It's as if it's either ignoring or misinterpreting ground.  Haven't looked at HeighModelInfo. Not sure I had come across that. So this may help with elevation.

Sorry I'm not posting the a whole lot of code here.  Still appreciate your feedback.

0 Kudos
Arne_Gelfert
Occasional Contributor III

@Tim_McGinnes  - so units and CRS match for view and layers but it turns out that when I use:

 

{...
ground : 'world-elevation'
...}

 

in my map definition, I get:

 

[esri.views.3d.layers.ElevationLayerView3D] #resolve() Failed to resolve layer view (layer title: 'Terrain3D', id: 'worldElevation') 

 

 because that layers has

Arne_Gelfert_0-1623356397537.png

while the scene has:

Arne_Gelfert_1-1623356431417.png

And per ESRI's book of non-no's:

A SceneView will only render layers that define a HeightModelInfo with an identical vertCRS to that of the scene, when using an ellipsoidal height model.

So thanks for pointing me in the right direction. Not entirely sure where I have to fix this - whether before publishing my service or in the code somewhere - but the fog is lifting for sure.

0 Kudos