GPS and QMC5883L Magnetometer

I am working on an autonomous mower using only EspHome. I am trying to include a GPS and a magnetometer. I am getting the longitude and latitude from GPS. I am wondering if someone has used the GPS and magnetometer to calculate the error and correct the navigation. I would love to see some examples of the code implemented.

Thanks,