Difference in bufferGeodetic and SimpleMarkerSceneSymbol

607
3
Jump to solution
02-20-2023 09:26 PM
VineetMenon
New Contributor II

Hi,

 

I'm creating a circle (buffer operation with geodesic) and a sphere (SimpleMarkerSceneSymbol) from the same center and with the same radius. But I'm getting different results in both cases.

 

Any idea why?

 

Relevant code follows,

 

GraphicsOverlay layer = new GraphicsOverlay();
Point centerPoint = new Point(78, 22, SpatialReferences.getWgs84());
int radius = 1;
LinearUnit km = new LinearUnit(LinearUnitId.KILOMETERS);
SimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF00FF00, 3);
SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0x11FF0000, simpleLineSymbol);
Polygon polygon = GeometryEngine.bufferGeodetic(centerPoint, radius, km, Double.NaN, GeodeticCurveType.GEODESIC);
Graphic rangeGraphic2D = new Graphic(polygon, simpleFillSymbol);
layer.getGraphics().add(rangeGraphic2D);

SimpleMarkerSceneSymbol redSphereSymbol = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbol.Style.SPHERE, 0x77FF0000, radius * 1000,
radius * 1000, radius * 1000, SceneSymbol.AnchorPosition.CENTER);
Graphic rangeBalloon3D = new Graphic(centerPoint, redSphereSymbol);

// add the graphic to the graphics overlay
layer.getGraphics().add(rangeBalloon3D);

mapView.getGraphicsOverlays().add(layer);

Untitled.png 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
MarkBaird
Esri Regular Contributor

Hi @VineetMenon 

When you are creating a SimpleMarkerScene symbol (which can be a cone, tetrahedron, tube etc) you create it by specifying the height, width and height.  The difference you are seeing with your geodesic buffer can be explained because you are working with a radius from a point effectively.

I fixed your code by setting the size of the symbol dimensions to twice the radius of your buffer.  Note that because you are working in 3D with a SimpleMarkerSceneSymbol, the shape you end up with is a geodetic albeit slightly generalised.  

 

 

      // the size needs to be 2 times the radius of the buffer
      SimpleMarkerSceneSymbol redSphereSymbol = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbol.Style.SPHERE, 0x77FF0000, radius * 2000,
          radius * 2000, radius * 2000, SceneSymbol.AnchorPosition.CENTER);
      Graphic rangeBalloon3D = new Graphic(centerPoint, redSphereSymbol);

 

 

This is the result with the corrected dimensions:

MarkBaird_0-1676969726995.png

Does this help?

View solution in original post

3 Replies
MarcoBoeringa
MVP Regular Contributor

Well, exactly as you say: you create a geodesic buffer (which is the only really accurate buffer), and compare the result with a plain circle with radius calculated in what is likely a high distortion projection like Web Mercator. This is the classic "Greenland-is-as-big-as-Africa" in Web Mercator problem, where in reality Greenland is far smaller than the Africa continent.

In such situations, at high latitude, the "plain circle" will be much smaller than the geodesic buffer, and severely underestimate / under-represent the real size of the buffer (which, again, can only be properly represented by the geodesic buffer).

If you need accurate buffers in a high distortion projection like Web Mercator, only use geodetic buffers. If you have a low distortion local projection (e.g. data within one UTM zone), you can get away with using planar buffer calculation, and it will be relatively accurate (but still not as good as geodetic).

0 Kudos
MarkBaird
Esri Regular Contributor

Hi @VineetMenon 

When you are creating a SimpleMarkerScene symbol (which can be a cone, tetrahedron, tube etc) you create it by specifying the height, width and height.  The difference you are seeing with your geodesic buffer can be explained because you are working with a radius from a point effectively.

I fixed your code by setting the size of the symbol dimensions to twice the radius of your buffer.  Note that because you are working in 3D with a SimpleMarkerSceneSymbol, the shape you end up with is a geodetic albeit slightly generalised.  

 

 

      // the size needs to be 2 times the radius of the buffer
      SimpleMarkerSceneSymbol redSphereSymbol = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbol.Style.SPHERE, 0x77FF0000, radius * 2000,
          radius * 2000, radius * 2000, SceneSymbol.AnchorPosition.CENTER);
      Graphic rangeBalloon3D = new Graphic(centerPoint, redSphereSymbol);

 

 

This is the result with the corrected dimensions:

MarkBaird_0-1676969726995.png

Does this help?

VineetMenon
New Contributor II

Ah.. Thanks. 

 

I read the API wrong. I was imagining it to be radius, when it was supposed to be diameter.

Thanks again.

0 Kudos