AnsweredAssumed Answered

get the center of a graphic layer

Question asked by fallingdog Champion on Jul 9, 2014
Latest reply on Jul 22, 2014 by fallingdog

How can I get the center of a graphic layer (or polygon geometry) in the android runtime sdk? I would think that the geometry engine would have something in it, but I do not see it in the api (I am probably looking right past it...).

 

Thanks for any help,

 

Forest

 

code for adding the ploygon layer

public void onStartSearchButtonClickListener() { 
if (searchFlag) { 
clearSearch(); 
} 
searchIndex = searchFragment.getIndex() + 1; 
if (searchIndex == 0) { Toast.makeText(getApplicationContext(), 
"No Feature found by that name...", Toast.LENGTH_LONG) .show(); 
} else { 
try { searchFeature = geodatabaseFeatureTable.getFeature(searchIndex); 
} catch (TableException e1) { 
// TODO Auto-generated catch block 
e1.printStackTrace(); 
} 
} 
searchFeatureGeometry = searchFeature.getGeometry(); 
searchGraphic = new Graphic(searchFeatureGeometry, sls); 
searchGraphicLayer = new GraphicsLayer(); 
searchGraphicLayer.addGraphic(searchGraphic); 
mMapView.addLayer(searchGraphicLayer); 
searchFlag = true; 
} 
}

 

code for the center point of of the polygon....?

Outcomes