OK, that was fun

but at least now it calculates the correct approximate distances with the location.distanceTo function.
What I found:
EarthquakeProvider.java
Notice the following declarations:
Code:
// Column indexes
public static final int LONGITUDE_COLUMN = 3;
public static final int LATITUDE_COLUMN = 4;
This little reversal in the index for the LONGITUDE_COLUMN and LATITUDE_COLUMN was what was throwing my distance calculation off.
Earthquake.java
private void loadQuakesFromProvider(){
Code:
Float lat = c.getFloat(EarthquakeProvider.LATITUDE_COLUMN) ;
Float lng = c.getFloat(EarthquakeProvider.LONGITUDE_COLUMN);
String mag = c.getString(EarthquakeProvider.MAGNITUDE_COLUMN);
String dep = c.getString(EarthquakeProvider.DEPTH_COLUMN);
String link = c.getString(EarthquakeProvider.LINK_COLUMN);
Location location = new Location("dummy");
location.setLongitude(lng);
location.setLatitude(lat);
if(currentLocation != null){
int dist = (int)currentLocation.distanceTo(location);
distance = String.valueOf(dist/1000);
}
My location object had the lat & lng values reversed!! because the index values had been reversed as pointed out earlier.
The question for me was why was it displaying the correct map overlay coordinates ?????
Then I looked closer at:
EarthquakeOverlay.java
Code:
private void refreshQuakeLocations() {
if (earthquakes.moveToFirst())
do {
Double lat = earthquakes.getFloat(EarthquakeProvider.LATITUDE_COLUMN) * 1E6;
Double lng = earthquakes.getFloat(EarthquakeProvider.LONGITUDE_COLUMN) * 1E6;
String mag = earthquakes.getString(EarthquakeProvider.MAGNITUDE_COLUMN);
String dep = earthquakes.getString(EarthquakeProvider.DEPTH_COLUMN);
GeoPoint geoPoint = new GeoPoint(lng.intValue(),
lat.intValue());
Notice that in new GeoPoint() the lat & lng parameters have been reversed.
It should be
GeoPoint(int latitudeE6, int longitudeE6).
This is why the GeoPoints were showing up correctly on the map!!
So I changed the column indexes and corrected the GeoPoint input parameters and it works like a charm

I hope this helps someone else trying to include the distanceTo function in this example.
Happy Programming
Ross