Trouble with Mollweide projection

Hi,

I’m wanting to plot a portion of the globe using the Mollweide projection. Here is what I want to do:

gmt begin intmoll png
        gmt coast -JW-30/12 -R-100/20/0/90 -Di -GDarkOliveGreen1 -Wthinnest,black
gmt end

That is, the projection should be centred at 30° West, and the extent of the map should go from 100° West to 20° East, and the Equator to the North Pole. However, when I run this code, I get this error message:

coast [ERROR]: Eastern boundary is > 180 degrees from specified central meridian and thus your region is invalid
coast [ERROR]: General map projection error

This only happens when the map crosses the 0° meridian. Is there any option to prevent this behaviour?

Hi @timhume

The error text seems a bit confusing, but I think the problem is that the Mollweide projection (at least in GMT) is intended for global mapping. If you specify the region as -Rg it works.

Maybe you should look for a cylindrical projection (as Mollweide is pseudo-cylindrical) like a transverse Mercator?

Regards

Thanks @Jose-Alvarez ,

What I am trying to do is create an interrupted Mollweide plot of the globe, focussing on the oceans. To get around the 0° issue (which I think is a bug), I have my map start and end at 0° rather than crossing it. The code below will illustrate what I am doing:

#!/usr/bin/env bash

gmt begin intmoll jpg
        gmt gmtset MAP_FRAME_PEN thin,black
        gmt grdimage @earth_relief_02m -JW60/11 -R0/110/0/90 -Cetopo1 -I -BWEN
        gmt grdimage @earth_relief_02m -JW190/15 -R110/260/0/90 -I -BWEN -X11
        gmt grdimage @earth_relief_02m -JW330/10 -R260/360/0/90 -I -BWEN -X15
        gmt grdimage @earth_relief_02m -JW90/14 -R0/140/-90/0 -I -BWES -X-26 -Y-9
        gmt grdimage @earth_relief_02m -JW220/15 -R140/290/-90/0 -I -BWES -X14
        gmt grdimage @earth_relief_02m -JW340/7 -R290/360/-90/0 -I -BWES -X15
gmt end

And here’s what it looks like

However, I’d really like the western edge of the map to start at 20° East, and the eastern edge to also finish there. That way it would show the Atlantic Ocean better.

I got this map with your code with the dev version. Probably it is a bug that was fixed.

1 Like

Mmm ok!

Sorry for my misunderstanding of the projection use. Your map really look awesome. Maybe is not ideal, but you can offset the input grid by -20º so the 0º is in fact the 20º using grdedit.
This how the code looks:

#!/usr/bin/env bash
grid=ETOPO1_Bed_offset.grd
gmt begin intmoll jpg
		gmt grdedit ETOPO1_Bed.grd -G$grid -R-200/160/-90/90 -V -fg
        gmt gmtset MAP_FRAME_PEN thin,black
        gmt grdimage $grid -JW60/11 -R0/110/0/90 -Cetopo1 -I -BWEN -E100
        gmt grdimage $grid -JW190/15 -R110/260/0/90 -I -BWEN -X11 -E100
        gmt grdimage $grid -JW330/10 -R260/360/0/90 -I -BWEN -X15 -E100
        gmt grdimage $grid -JW90/14 -R0/140/-90/0 -I -BWES -X-26 -Y-9 -E100
        gmt grdimage $grid -JW220/15 -R140/290/-90/0 -I -BWES -X14 -E100
        gmt grdimage $grid -JW340/7 -R290/360/-90/0 -I -BWES -X15 -E100
gmt end

And this is the result:

Regards

1 Like

Yes, I remember fixing things similar to this.

1 Like

Thanks everyone. Looks like I’ll need to install the dev version.

Edit: installed dev. Here’s the code, and the map

#!/usr/bin/env bash

gmt begin intmoll jpg
        gmt gmtset MAP_FRAME_PEN thin,black
        gmt grdimage @earth_relief_02m -JW60/9 -R20/110/0/90 -Cetopo1 -I -BWEN
        gmt grdimage @earth_relief_02m -JW190/15 -R110/260/0/90 -I -BWEN -X9
        gmt grdimage @earth_relief_02m -JW-30/12 -R-100/20/0/90 -I -BWEN -X15
        gmt grdimage @earth_relief_02m -JW90/12 -R20/140/-90/0 -I -BWES -X-24 -Y-9
        gmt grdimage @earth_relief_02m -JW220/15 -R140/290/-90/0 -I -BWES -X12
        gmt grdimage @earth_relief_02m -JW-20/9 -R-70/20/-90/0 -I -BWES -X15
gmt end

And it’s easy enough to alter the cuts so that the continents get emphasised instead of the oceans.

1 Like

See a related issue

Interrupted maps are nice - but there are so many extra things to worry about. I suspect hacking together scripts to do interrupted maps when required might be the pragmatic solution.

I got the idea for doing an interupted Mollweide projection from NASA’s Panoply software (which has an enormous number of map projections). I then plotted some weather data on the map which gives precedence to the oceans, and sent it out as an April Fool’s day joke at work - I said that henceforth all weather charts from the Australian Bureau of Meteorology had use this map projection to properly respect the importance of the Pacific region! It seemed to go down quite well with a subset of the staff.

Maybe a good contribution to the Showcase?

I might cook up a GMT.jl recipe with your script :wink: