ossama-othman / MaRC

MaRC - Map Reprojections and Conversions
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Mercator projection range calculations are incorrect #58

Closed ossama-othman closed 6 years ago

ossama-othman commented 6 years ago

Calculations in MaRC's Transverse Mercator projection assume that the poles (+/- 90 degrees) may be mapped. That is incorrect since the distortion in that projection approaches infinity at the poles. A user-configurable maximum latitude should be supported for the Mercator projection in a way similar to the Polar Stereographic projection does that.

Furthermore, the xmax calculation in the MaRC::Mercator::plot_map() and plot_grid() methods seem to assume that xmax is a latitude. It is not. The MaRC::Mercator::mercator_x() should be used to determine xmax at the maximum configured latitude range. Determine whether or not the code needs to be corrected.

ossama-othman commented 6 years ago

Some parts of this issue have been corrected in commit 09455a8. More fixes to come.

ossama-othman commented 6 years ago

Upon closer examination, the value xmax is not assumed to be a latitude as originally surmised. Xmax is derived like so:

 lines    2 * xmax
------- = --------
samples    2 * pi  (radians)

        lines
xmax = ------- * pi
       samples

Xmax scales with the number of lines in the map. The greater the number of lines in the map, the greater maximum latitude.