Fix longitude error for southern hemisphere.

The problem was the cprModFunction() not calculating the absolute value
of the latitude, so the table only worked for the northen hemisphere.

Thanks to @pwarren for finding the bug.

This fixes issue #13.
This commit is contained in:
antirez 2013-04-08 09:43:04 +02:00
parent ff0fe38722
commit b885085a74

View File

@ -1610,6 +1610,7 @@ int cprModFunction(int a, int b) {
/* The NL function uses the precomputed table from 1090-WP-9-14 */ /* The NL function uses the precomputed table from 1090-WP-9-14 */
int cprNLFunction(double lat) { int cprNLFunction(double lat) {
if (lat < 0) lat = -lat; /* Table is simmetric about the equator. */
if (lat < 10.47047130) return 59; if (lat < 10.47047130) return 59;
if (lat < 14.82817437) return 58; if (lat < 14.82817437) return 58;
if (lat < 18.18626357) return 57; if (lat < 18.18626357) return 57;