Map up to the south pole. Bug in -R+uk?

I want to make a rectangular map with a Lambert projection (-JA-60/-40/15c) that extends just up to the south pole (like this map).

So I using -R xmin/xmax/ymin/ymax +u unit to define the region. So I used this to calculated the distance to the South Pole which gives 5573 km.

S=$(echo -60 -40 | gmt mapproject -G-60/-90+uk -o2)

But I get this image. By try and error I found that I must used -5420 to get the map that I want. Am I using the R method right? Is it a bug?

#!/usr/bin/env bash
    	Lat=-40
    	S=$(echo -60 ${Lat} | gmt mapproject -G-60/-90+uk -o2)

    #	Region geografica del mapa
    	REGION=-2500/3100/-5573/2100+uk
        #REGION=-2500/3100/-5420/2000+uk
    	#REGION=-2500/3100/${S}/2000+uk

    gmt begin SouthPole png
    	gmt coast -R$REGION -JA-60/${Lat}/15c -Dl -W -N1 -G245/241/214 -S199/224/246 -Bg10
    gmt end #show

I think you are doing it right but GMT may not be. The conversion from your +uk to the equivalent -R.+r settings in degrees takes place in gmtinit_rectR_to_geoR in gmt_init.c. You can have a look and see if you notice anything funny for your case. I will have a look later once done with current PR…

Actually, you are using in wrong… Your measure from mapproject is the actual length of the curved arc along the meridian on a spherical Earth, whereas the coordinates in -R…+uk are distances on a flat projection of the Earth, so it depends on the properties of the projection. If I do things like this:

echo 0 -90 | gmt mapproject -Rg -JA-60/-40/25c -C -Fk
3.72772596975e-13	-5385.00930501

and use -5385.00930501 then it looks as you expect.

Thanks. I think -R+uk is more complex than I thought.

Yes, it refers to (flat) map distances, not (spherical/ellipsoidal) Earth distances.

You can check if the documentation is not clear. I think it does say projected distances or similar though.

So, for example if I want a map to extend 4000 km to the south (from the standard lat and long), how should I do?

If you mean a real Earth distance of 4000 km then you would compute the coordinate of the point that is 4000 km to the south, e.g.

echo -60 -40 | gmt vector -Tt180/4000k
-60	-75.9728147105

and then get the flat map coordinate of that point for your chosen projection:

echo -60 -75.9728147105 | gmt mapproject -Rg -JA-60/-40/1 -C -Fk
0	-3934.62493195

and then use that in your -R…+r.

Ok. Thanks. I will need to study a bit it seems.