Android Arcgis 100.3:如何获取MapView的中心点

时间:2018-07-31 07:27:49

标签: android android-mapview arcgis

如何从ArcGis的MapView屏幕中心获取Point,以表示其纬度和经度?

2 个答案:

答案 0 :(得分:0)

float centreX=mapView.getX() + mapView.getWidth()  / 2;
float centreY=mapView.getY() + mapView.getHeight() / 2;

android.graphics.Point screenPoint = new android.graphics.Point(Math.round(centreX), Math.round(centreY));
Point mapPoint = mv.screenToLocation(screenPoint);
Point wgs84Point = (Point) GeometryEngine.project(mapPoint, SpatialReferences.getWgs84());

double lat = wgs84Point.getY();
double lng = wgs84Point.getX();

答案 1 :(得分:0)

默认情况下,很容易获得中心坐标将线放在下面

 LatLng target = mMap.getCameraPosition().target;

通过访问latlng类的经纬度成员获取经纬度

target.latitude;
target.longitude;