Skip to content

Instantly share code, notes, and snippets.

@svenkapudija
Created November 29, 2012 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenkapudija/4171462 to your computer and use it in GitHub Desktop.
Save svenkapudija/4171462 to your computer and use it in GitHub Desktop.
LatLon GeoPoint - GeoPoint with double latitude and longitude
public class LatLonGeoPoint extends GeoPoint {
private double lat;
private double lon;
public LatLonGeoPoint(double lat, double lon) {
super((int) (lat*1E6), (int) (lon*1E6));
}
public double distanceTo(LatLonGeoPoint other) {
float[] results = new float[2];
Location.distanceBetween(getLat(), getLon(), other.getLat(), other.getLon(), results);
return results[0];
}
public double getLat() {
return lat;
}
public double getLon() {
return lon;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment