【发布时间】:2018-07-31 07:27:48
【问题描述】:
如何从 ArcGis 的 MapView 屏幕中心获取 Point,代表它的经纬度?
【问题讨论】:
标签: android android-mapview arcgis
如何从 ArcGis 的 MapView 屏幕中心获取 Point,代表它的经纬度?
【问题讨论】:
标签: android android-mapview arcgis
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();
【讨论】:
默认情况下,很容易得到中心坐标,把线放在下面
LatLng target = mMap.getCameraPosition().target;
通过访问latlng类的经纬度成员获取经纬度
target.latitude;
target.longitude;
【讨论】: