Durga Durga - 5 months ago 14
Android Question

How to Get Buffer for Road in Arcgis Android?

I am developing one Application using

arcgis
. Here i want to implement buffer for both point and line Segments (road).

Here i successfully get buffer for point using this method

GeometryEngine.buffer(geometry1,mMapView.getSpatialReference(), meters, null)


where as for road if it is single Segment i am able draw buffer.I am unable to draw buffer for multiple Segments.

Please give me solution for this.I want like

my code
enter image description here

polygon = GeometryEngine.buffer(geometry1,
mMapView.getSpatialReference(), meters, null);
withingeometry = GeometryEngine.project(polygon,
mMapView.getSpatialReference(),
mMapView.getSpatialReference());

SimpleFillSymbol sls = new SimpleFillSymbol(Color.TRANSPARENT);
sls.setAlpha(75);

Graphic graphics= new Graphic(withingeometry,sls);
buffergraphiclayer.addGraphic(graphics);
mMapView.addLayer(buffergraphiclayer);

Answer

There are two options that should produce the result you want, both involving the GeometryEngine.union(Geometry[], SpatialReference) method:

  1. Call union on an array of the Geometry objects you want to buffer to produce a single Geometry, and then call buffer on that single Geometry.
  2. Call buffer on an array of the Geometry objects you want to buffer to produce a Polygon array, and then call union on that Polygon array.