To compute distances between two close points, given their latitude and longitude, the following methodology works well. If (Current_Latitude, Current_Longitude) is your current location, and (Latitude, Longitude) is another location, simply compute as follows:
float LatDiff = Current_Latitude - Latitude;
float LongDiff = Current_Longitude - Longitude;
float CosCurLat = Math.cos(Current_Latitude);
float ConversionFac = 6371000 * Math.PI / 180; // 6371000 is earth radius in metres
float Dist_metres = ConversionFac * Math.sqrt(LatDiff*LatDiff + LongDiff*LongDiff*CosCurLat *CosCurLat );
The basic idea of this method is that it works out how many metres a degree of latitude and longitude is worth at your current location. For implementation, note that the ConversionFac is a constant, so (depending on your language) you can probably set it as a global static constant somewhere. Also, CosCurLat only needs to be calculated once for all the other locations that you're interested in.
Implementation notes: The ConversionFac
assumes that the latitudes and longitudes are in degrees. However a lot of cos
functions take radians as the argument, so be sure to convert as required.