Calculate a value of region for a fixed value of widht, heigth and projection

I made an animation with the map of 17.64 cm width and 18.289 cm heigth with a Mercator projection (-JM17.64cm) and a for the region -79/-43/-50/-20.

Now I want another animation for a different region but keeping the same width, height and projection of the map (so I could use the same canvas). So given 3 values of region (for example -R-75/?/-30/-20), can GMT calculate the east boundary of the map?

Hi @Esteban82 have a look at mapproject -I. In combination with -R...+r this might do what you want if you feed it your required dimensions

Hi Kristof! I’ m not sure exactly how should I do it, especially when I would be giving only 3 values to -R.

For trial and error I get that the answer is -R-75/-64.388/-30/-20.

Ok, my answer is not exactly what you were looking for. My apologies. I’m only aware of calculating the upper latitude for a given width and longitudinal span of your plot. I have no idea if/how you can restrict the height of a plot for a given vertical extent in latitude.

I should do the math. Based on the projection, latitudes and height the “vertical” scale can be calculated, and then with that value, the “horizontal” scale could be obtain and finally I would get the range of longitudes.

If you are OK with specifying the center of your area and dimensions in km then you can get a fixed dimension map this way:

gmt mapproject -R-2000/2000/-1500/1500+uk -JM20/30/15c -W

you can change the lon/lat center and you wil get different wesn in degrees. Try it with

gmt coast -R-2000/2000/-1500/1500+uk -JM20/30/15c -B -Gred -pdf t

and vary the latitude, for instance. If you need those wesn in degrees you can feed the output of the above mapproject back to mapproject using -I and no -W and you get east/north. Feed it 0 0 to get south west.