鼠标点击地图上的一点,显示当前坐标。需要注意转换。具体代码如下:
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
android.graphics.Point point=new Point(
Math.round(e.getX()), Math.round(e.getY()));
com.esri.arcgisruntime.geometry.Point wPoint = (com.esri.arcgisruntime.geometry.Point) GeometryEngine.project(gp, SpatialReferences.getWgs84());
mView.setText("经纬度坐标: " + wPoint.getX() +" , " + wPoint.getY());
return super.onSingleTapUp(e);
}
});
有时官方英文文档,不一定能一下子全看明白。有时还需要不断的去测试,反复去理解。
https://developers.arcgis.com/android/spatial-and-data-analysis/geometry/