public static double metersBetween(double fromLon, double fromLat, double toLon, double toLat) {
    double sinDeltaLat = Math.sin((toLat - fromLat) * RADIANS_PER_DEGREE / 2);
    double sinDeltaLon = Math.sin((toLon - fromLon) * RADIANS_PER_DEGREE / 2);
    double a = sinDeltaLat * sinDeltaLat +
      sinDeltaLon * sinDeltaLon * Math.cos(fromLat * RADIANS_PER_DEGREE) * Math.cos(toLat * RADIANS_PER_DEGREE);
    return AVERAGE_WORLD_RADIUS_METERS * 2 * Math.asin(Math.sqrt(a));
  }
Returns the distance in meters between 2 lat/lon coordinates using the haversine formula.
planetiler-core/src/main/java/com/onthegomap/planetiler/geo/GeoUtils.java