The haversine formula can be greatly simplified if you work only in the north-south and east-west directions.
If the Earth’s circumference is C, a point at a distance of d kilometers south of this point is 360 * d / C degrees south. Point in d kilometers east 360 * d / (C * cos (latitude)) degrees east. The cosine in the denominator assumes that the longitude at this latitude is shorter than the equator.
So, if the Earth’s circumference is 40,075.04 km, to move 5 m to the north / south you add / subtract 0.0000449 from latitude and use the same longitude. To move 5 m west / east, you must use the same latitude and add / subtract 0.0000449 / cos (latitude) by longitude. Do not forget about edge cases: near the poles you need to pinch the latitude to 90 °, and near the longitude of 180 ° you will also add or subtract 360 ° to keep the longitude in the correct range.
With your numbers, the range is something like this:
latitude: [23.23903 ; 23.23911] longitude: [50.45781 ; 50.45791]
Update: Please note that this still suggests that the Earth is an ideal sphere that it is not . For example, the GPS system models the Earth as an ellipsoid, where the equator is at an altitude of 6378.137 km, and the poles - at 6356.7523142 km from the center of the Earth. The difference is about 1/300 and is of great importance for many applications, but in this case it is within the margin of error.
Correcting the longitude formula should be simple, as the parallels are still circles: you just need to swap cos(latitude) with the correct coefficient. Calculating the correct latitude is more difficult, since the meridians are not circles, but ellipses, and the length of the ellipse arc cannot be calculated using elementary functions, so you should use approximations.
source share