Created
November 29, 2012 19:58
-
-
Save svenporto/4171462 to your computer and use it in GitHub Desktop.
LatLon GeoPoint - GeoPoint with double latitude and longitude
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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