Feature Layer rendering using ArcGis java sdk

278
4
07-08-2019 01:14 AM
AshunKothari
New Contributor

I am adding a feature layer to my arcgis scene. The problem is with the rendering as you can see the below image is the one when viewed the feature layer at an angle. You can notice stripes appearing in that layer after getting successfully rendered. 

This is the view of the same feature layer when viewed from the top. As you can see minimal stripes are being observed. 

I need help to remove the unnecessary strips. If anyone can help me out with a solution or pointing out where the problem lies it will be truly appreciated.

0 Kudos
4 Replies
MarkBaird
Esri Regular Contributor

Hi Ashun Kothari

Can you tell me a little more about your setup here:

 - What version of the SDK are you using?

 - What platform / OS are you running this on?

Would you be able to share the URL of the feature layer so I can try this out?

Thanks

Mark

0 Kudos
MarkBaird
Esri Regular Contributor

Actually I think I know the issue here, this looks like an issue with the depth buffering.  I can reproduce this easily with a graphics overlay which uses the same rendering pipeline as a feature layer.

// create a new point collection for polygon
PointCollection points = new PointCollection(SpatialReferences.getWebMercator());

points.add(new Point(0,0));
points.add(new Point(0,10000));
points.add(new Point(10000,10000));
points.add(new Point(10000,0));

// create the polyline from the point collection
Polygon polygon = new Polygon(points);

// fill symbol
SimpleFillSymbol sfs = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0xFF00FF00, null);

Graphic graphic = new Graphic(polygon, sfs);

GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
graphicsOverlay.getGraphics().add(graphic);

sceneView.getGraphicsOverlays().add(graphicsOverlay);

So when I view it from an angle you can see the issue:

So what is causing this?  Well you will notice that it's quite a large polygon made up from Z values of zero.  Due to the curvature of the earth, when we calculate the depth buffers part of the polygon is actually beneath the surface which causes the fuzzy rendering.

In the example above I was using a surface placement mode of "Absolute", which is absolute to the surface of the scene.  If I change the surface placement mode to draped, which as the name suggests drapes the geometry over the scene.

GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.DRAPED);
graphicsOverlay.getGraphics().add(graphic);

Now it renders correctly.

Note that the FeatureLayer class also has the SceneProperties class.

Have a look at this:

https://developers.arcgis.com/java/latest/api-reference/reference/com/esri/arcgisruntime/mapping/vie...

Does this help?

0 Kudos
AshunKothari
New Contributor

Hey Mark,

Thanks for the reply. I tried using the SceneProperties class and giving it as 

LayerSceneProperties.SurfacePlacement.DRAPED.

But as you can see the rendering is still not proper.

Here is the view at an angle:

Here is the top view: 

0 Kudos
MarkBaird
Esri Regular Contributor

Ashun,

Is there any way you can share your data?  If I could connect to the service I'd be able to reproduce it.

The only other thing I can think of just now is setting the render mode for the feature layer like this:

featureLayer.setRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);

This would generally improve the rendering experience of your polygons but if you don't have a good graphics card or your polygons contain lots of vertices then you might have issues with hardware resources.

https://developers.arcgis.com/java/latest/api-reference/reference/com/esri/arcgisruntime/layers/Feat...

Was also wondering what version of the SDK you are using.  Are you on the latest 100.5?

Mark

0 Kudos