Skip to content

Instantly share code, notes, and snippets.

@svenporto
Created November 29, 2012 19:58
Show Gist options
  • Save svenporto/4171462 to your computer and use it in GitHub Desktop.
Save svenporto/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