【ArcGIS for Android】经纬度坐标、地图投影坐标、屏幕坐标互相转换

时间:2024-04-15 20:57:40

 

SpatialReference mSR4326 = SpatialReference.create(4326);
SpatialReference mSR3857 = SpatialReference.create(3857);

 

1. 屏幕坐标转换成投影坐标

@Override
public boolean onSingleTap(MotionEvent point) {

SpatialReference sr = map.getSpatialReference();

Point dp = map.toMapPoint(point.getX(), point.getY());

}


2. 投影坐标转换成经纬度

Point wgsPoint = (Point) GeometryEngine.project(dp ,map.getSpatialReference(),mSR3857);

3、经纬度转换成投影坐标

Point mapPoint = (Point) GeometryEngine.project(wgsPoint ,mSR4326,map.getSpatialReference());

4、投影坐标转换成屏幕坐标

Point screenPoint = map.toScreenPoint(mapPoint);