Search code examples
androidarcgis

How to convert an Android esri arcGIS Point into latitude and longitude


I'm trying to get Latitude and Longitude of a tap over a Android esri arcGIS MapView.

        map.setOnSingleTapListener(new OnSingleTapListener() {

            private static final long serialVersionUID = 1L;

            public void onSingleTap(float x, float y) {
                System.out.println("x:" + x);
                System.out.println("y:" + y);
                // How to get Latitude Longitude coordinates of the point (x,y)?

            }
        });

How to get Latitude Longitude coordinates of the point (x,y)?


Solution

  • The easiest way is:

    Point p=map.toMapPoint(arg0, arg1);
    System.out.println("X="+p.getX());
    System.out.println("Y="+p.getY());
    

    The variable p will have the coordinates mapped in the MapView.