Search code examples
androidgeolocationhere-api

How to get latitude and longitude using Here Map for android SDK?


I wanted to add the marker on touched location on Here Map. Also, i wanted to show the latitude and longitude where i touched the location. I am successful in showing the marker But i cannot able to show the latitude and longitude in toast message.

I have implemented my own gesture listener as explained in the doc: public class MyOnGestureListener implements MapGesture.OnGestureListener In this there is an overridden method i used:

@Override
public boolean onTapEvent(PointF p) {
    // Toast.makeText(context, " Show latitude and langitude on touched location: " , Toast.LENGTH_SHORT ).show();
    return true;
}

In this i wanted to show latitude and longitude.


Solution

  • You can use Map#pixelToGeo(PointF point) API to get the GeoCoordinate from the PointF. Then you can obtain the latitude and longitude values from the GeoCoordinate.

    Map pixelToGeo API Reference