Mapproject Mollweide Transformation

I have coordinates given in a Mollweide projection and need to transform them into lat,lon. The coordinates have an ESRI:54009 specification attached to them. See this link.

That particular EPSG web page gives projected bounds that GMT’s mapproject -Jw is unable to match. For example, the western bound value is given on ESPG to be -18040095.7 meters. If we use that western bound and request the lon,lat from mapproject, we get:

> echo -18040095.7 0.0 | gmt mapproject -Jw0/1:1 -R-180/180/-90/90 -C -Fe -I --FORMAT_FLOAT_OUT=%.8f
NaN	NaN

And if, we try sending -180°,0 through mapproject to get what it thinks is the western Mollweide bound, we get:

> echo -180 0.0 | gmt mapproject -Jw0/1:1 -R-180/180/-90/90 -C -Fe --FORMAT_FLOAT_OUT=%.8f
-18019929.52239636	0.00000000

which is about 20,166.2 meters short of the ESRI:54009 western bound. Huh?

Same kind of thing happens along the prime meridian. Transforming 0,90 through mapproject gives a value of 9009964.76119818 meters; about 10,083.09 meters short of the ESRI:54009 value (half of the E/W value. Ooo, that should tell us something.).

Is there more than one Mollweide projection? The only thing that makes sense is that the ESRI-based coordinates are scaled in some fashion (or mapproject’s are). Everything should be based on the WGS-84 ellipsoid.

Any ideas?

Probably a spherical vs ellipsoidal issue

C:\v>echo -180 0.0 | mapproject -J"+proj=moll +lon_0=0 +x_0=0 +y_0=0"
-18040095.6961  0

C:\v>echo -18040095.6961 0.0 | mapproject -J"+proj=moll +lon_0=0 +x_0=0 +y_0=0" -I
-180    0
1 Like

Fixed in https://github.com/GenericMappingTools/gmt/pull/8238 but you could speed this up by reporting bugs on GitHub straight away than to waste the extra circuit on the Forum for clear bugs.

Ha!

I can never confidently tell whether I’ve found a bug or that I’m simply abusing GMT is some silly way! Hence I tend to come to the forum, first!

I’d rather have someone tell me I’m a dolt for trying to do something stupid with one of the commands than get the team all riled up trying to fix something that I should have never tried to do in the first place!

Thanks for the fix and happy New Year!

Something is still a little strange. Both of these commands yield the same result. Should that be happening?

> echo -18040095.7 0.0 | gmt mapproject -Jw0/1:1 -R-180/180/-90/90 -C -Fe -I --FORMAT_FLOAT_OUT=%.8f
-180.00000000	0.00000000
> echo -18019929.52239636 0.0 | gmt mapproject -Jw0/1:1 -R-180/180/-90/90 -C -Fe -I --FORMAT_FLOAT_OUT=%.8f
-180.00000000	0.00000000

FWIW, Joaquim’s use of “+proj=moll…” appears to give correct results.

I get

echo -18040095.7 0.0 | gmt mapproject -Jw0/1:1 -R-180/180/-90/90 -C -Fe -I --FORMAT_FLOAT_OUT=%.8f --PROJ_ELLIPSOID=sphere
-180.00000000 0.00000000

echo -18019929.52239636 0.0 | gmt mapproject -Jw0/1:1 -R-180/180/-90/90 -C -Fe -I --FORMAT_FLOAT_OUT=%.8f --PROJ_ELLIPSOID=sphere
-179.99995506 0.00000000