Search code examples
androiddictionarygeolocationosmdroid

Are the geopoint different for osmdroid and Android application?


I am using OsmDroid for my Android application. I am setting a IGeoPoint as follows

IGeoPoint point2 = new IGeoPoint() {

        public int getLongitudeE6() {
            return 51475022;
        }

        public int getLatitudeE6() {
            return -300322;
        }
    };  
mapController.animateTo(point2);

this took me to deep blue sea. Whereas when I use google.mapview and set geopoint in following way

myMapController.animateTo(new GeoPoint((int) (51.475022 * 1E6),
            (int) (-0.300322 * 1E6)));

it takes me to where I want

What's wrong with osmdroid?


Solution

  • Why are you trying to create a constructor for an Interface?

    The Osmdroid GeoPoint is a class which implements this interface. You just need to instantiate a GeoPoint, like this:

    GeoPoint gPt = new GeoPoint(51500000, -150000); // latitude, longitude
    

    Then pass this to your .animate()