Clip and border paths do not match

I’m trying to make a map of Morocco, where the country is highlighted. I basically get what I want from this script:

gmt begin test png
gmt grdimage @earth_relief_01m -R-15/26/0/37r -JM10c
gmt coast -N1/0.40p,180
gmt coast -EMA+C
gmt coast -G220 -t40
gmt coast -Q
gmt end show

There’s just one problem. The border and the highlighted (clipped) area do not agree where the country ends as this image shows (look at the southeastern border):

Why do border and clipped area not match? Is there anything I can do to make it match?

I’m using GMT version 6.4.0 on macOS, installed via Homebrew.

They do not match becuase you are using two different dataset (that sometimes have this errors).

You could use the DCW data set to aslo plot the boundiries with gmt coast -EMA+p0.40,180 (instead of gmt coast -N1/0.40p,180).

gmt begin test png
gmt grdimage @earth_relief_01m -R-15/26/0/37r -JM10c
gmt coast -EMA+p0.40,180
gmt coast -EMA+C
gmt coast -G220 -t40
gmt coast -Q
gmt end show
1 Like

Thanks, it’s a step in the right direction, but with this solution the border is also drawn along the coast line. I’ve plotted the border in red to make it easier to see:

Isn’t it possible to use the Digital Chart of the World dataset (used by -R, -N etc. if I understand this correctly) to clip the outside of a country?

Yes, the DCW use are closed polygones around the (emerged) areas of the each country without distinction between international boundaries and coastlines. So, there is not direct way to NOT plot the coastline.

The modifier in -EMA+C is for an outside clip.

  • +c to set up an inside clip path based on your selection.
  • +C to set up an outside (area between selection and map boundary) clip path based on your selection.

Or do you need an inside clip? I made the following map with gmt coast -EMA+c:

Make sure you add -Df to the pscoast calls to get the full-resolution coastline. It is hopefully closer to the DCW polygon.

I tried using -Df, but there wasn’t any (visual) improvement.

OK, thanks for trying. It is just discrepancies between two different and dated datasets…