isNear static method

bool isNear(
  1. ILatLong me,
  2. ILatLong other
)

Returns true if the other point is equal or near this point. We use 0.00005 which is a distance of maximum 5.57m at the equator in each lat/lon direction

Implementation

static bool isNear(ILatLong me, ILatLong other) {
  if (me.latitude == other.latitude && me.longitude == other.longitude) return true;
  // now we have to rould the values so that we can compare them
  double latitude1 = roundToMicrodegreees(me.latitude);
  double latitude2 = roundToMicrodegreees(other.latitude);
  if ((latitude1 - latitude2).abs() > nearDistance) return false;
  double longitude1 = roundToMicrodegreees(me.longitude);
  double longitude2 = roundToMicrodegreees(other.longitude);
  if ((longitude1 - longitude2).abs() > nearDistance) return false;
  return true;
}