Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GeoPoint with lat/long values

I am trying to get a GeoPoint for -23.4456 by 45.44334

What values do I pass into the constructor of the GeoPoint as it take Ints only.

like image 963
Ian Vink Avatar asked Aug 26 '10 17:08

Ian Vink


People also ask

How do you compare lat and long?

Location float[] distance = new float[1]; Location. distanceBetween(lat, lon, currentLat, currentLon, distance); // distance[0] is now the distance between these lat/lons in meters if (distance[0] < 2.0) { // your code... } Save this answer.

What does LatLng mean?

LatLng(double latitude, double longitude) Constructs a LatLng with the given latitude and longitude, measured in degrees.


1 Answers

GeoPoint coordinates are based in microdegrees (degrees * 1e6) -- written here

float lat = -23.4456f; float lng = 45.44334f; GeoPoint gp = new GeoPoint((int)(lat * 1E6), (int)(lng * 1E6)); 
like image 60
Itsik Avatar answered Sep 29 '22 18:09

Itsik