MapView center point

459
1
08-13-2019 02:15 AM
S_MMaruf
New Contributor II

Hi, 

How to get MapView's center point using method if there is any? or Hints how to get it from MapView in arcgis java sdk?

0 Kudos
1 Reply
MarkBaird
Esri Regular Contributor

The current area covered by your mapview is the ViewPoint.  

You can read the Viewpoint into an Envelope geometry.  From that Envelope you can call getCenter() which is the centre point of your screen

Envelope extent = (Envelope) mapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY).getTargetGeometry();
System.out.println("extent " + extent.toString());
System.out.println("centre " + extent.getCenter().toString());

Is this what you are after?

0 Kudos