coordinates singletap mapview

1186
2
Jump to solution
07-28-2016 07:49 AM
MohamedEzzerI
New Contributor III

How to get coordinates on singletap mapview ?

0 Kudos
1 Solution

Accepted Solutions
AlexanderNohe1
Regular Contributor II

mMapView.setOnSingleTapListener(new OnSingleTapListener() {

  @Override public void onSingleTap(float v, float v1) {

  Point p = mMapView.toMapPoint(v,v1);
   Point newPoint =

  (Point) GeometryEngine.project(p, mMapView.getSpatialReference(), SpatialReference.create(4326));
   Log.e("NewPointCoords", "" + newPoint.getX() + " " + newPoint.getY());
  }

});

This would give you the coordinates in spatial reference 4326

View solution in original post

2 Replies
AlexanderNohe1
Regular Contributor II

mMapView.setOnSingleTapListener(new OnSingleTapListener() {

  @Override public void onSingleTap(float v, float v1) {

  Point p = mMapView.toMapPoint(v,v1);
   Point newPoint =

  (Point) GeometryEngine.project(p, mMapView.getSpatialReference(), SpatialReference.create(4326));
   Log.e("NewPointCoords", "" + newPoint.getX() + " " + newPoint.getY());
  }

});

This would give you the coordinates in spatial reference 4326

View solution in original post

AlexanderNohe1
Regular Contributor II

Hi Mohamed EzzerI​,

Did the previous example help resolve your issue?  If so, would you please mark it as correct?

Thanks.

0 Kudos