0

I'm using the ArcGIS Runtime .NET Quartz Beta

I have an application which needs to render large polygons on the 3D Scene View.

For instance, I execute this code:

            var ContourOverlayScene = CreateGraphicsOverlay("Contours");
            MySceneView.GraphicsOverlays.Add(ContourOverlayScene);


            List<MapPoint> combined = new List<MapPoint>();

            combined.Add(new MapPoint(-160,  20, wgs84));
            combined.Add(new MapPoint( 160,  20, wgs84));
            combined.Add(new MapPoint( 160, -20, wgs84));
            combined.Add(new MapPoint(-160, -20, wgs84));

            var arcpoly = new Esri.ArcGISRuntime.Geometry.Polygon(combined, wgs84);

            ContourOverlayScene.Graphics.Add(new Graphic() { Geometry = arcpoly, Symbol = new SimpleFillSymbol() { Color = Colors.Red } });

gives me this result (I was expecting the polygon to wrap most of the way around the globe)

enter image description here

So, I changed it to have intermediatepoints to try to force it to go around the globe, like this:

            combined.Add(new MapPoint(-160,  20, wgs84));
            combined.Add(new MapPoint(-40, 20, wgs84));
            combined.Add(new MapPoint(40, 20, wgs84));
            combined.Add(new MapPoint( 160,  20, wgs84));
            combined.Add(new MapPoint( 160, -20, wgs84));
            combined.Add(new MapPoint(40, -20, wgs84));
            combined.Add(new MapPoint(-40, -20, wgs84));
            combined.Add(new MapPoint(-160, -20, wgs84));

and the resulting picture is exactly the same....

How would I render the polygon I want to render?

David Hope
  • 2,216
  • 16
  • 32
  • Have you tried changing the order of the points so it goes the other way around? -160,20 | -160, -20 | 160, -20 | 160, 20 – Sami Kuhmonen Sep 14 '16 at 20:07
  • @SamiKuhmonen Yes, it doesn't seem to matter if they are clockwise or counter clockwise – David Hope Sep 14 '16 at 20:21
  • [This](http://gis.stackexchange.com/questions/18562/how-can-i-make-a-polyline-wrap-around-the-world) seems related: "You need to break the polyline at the +-180 degree meridian". You probably have to create 2 polygons, one that goes "left" and stops at the meridian, and one that goes right and stops at the meridian. – Quantic Sep 14 '16 at 20:26
  • @Quantic My polygon isn't supposed to cross the +-180 degree meridian, it's supposed to go the other (long) way around. Instead, it's crossing the meridian. – David Hope Sep 14 '16 at 21:04

1 Answers1

0

This is a bug in the 3D Renderer. The only way around it that I've found is to create two graphics, and each half must be less than 180 degrees wide. It didn't even work when creating a single polygon with two parts (the outline rendered correctly but the fill was still wrong)

        var pb = new PolygonBuilder(wgs84);
        combined.Add(new MapPoint(-160, 20, wgs84));
        combined.Add(new MapPoint(0, 20, wgs84));
        combined.Add(new MapPoint(0, -20, wgs84));
        combined.Add(new MapPoint(-160, -20, wgs84));
        pb.AddPart(combined);

        ContourOverlayScene.Graphics.Add(new Graphic() { Geometry = GeometryEngine.Densify(pb.ToGeometry(),1), Symbol = new SimpleFillSymbol() { Color = Colors.Red } });

        pb = new PolygonBuilder(wgs84);

        combined = new List<MapPoint>();
        combined.Add(new MapPoint(0, 20, wgs84));
        combined.Add(new MapPoint(160, 20, wgs84));
        combined.Add(new MapPoint(160, -20, wgs84));
        combined.Add(new MapPoint(0, -20, wgs84));
        pb.AddPart(combined);

        ContourOverlayScene.Graphics.Add(new Graphic() { Geometry = GeometryEngine.Densify(pb.ToGeometry(), 1), Symbol = new SimpleFillSymbol() { Color = Colors.Red } });

I have logged a bug in the ArcGIS Runtime, so hopefully this can get fixed - however currently parts > 180 will go the short way in 3D by design, so you might still have to split the geometry in two parts.

dotMorten
  • 1,953
  • 1
  • 14
  • 10