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

**URL:** <https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308>\
**Category:** Q&A\
**Created:** [February 5, 2021, 8:03pm UTC](https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308 "2021-02-05T20:03:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [February 5, 2021, 8:03pm UTC](https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308/1 "2021-02-05T20:03:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![KristofKoch](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/kristofkoch/32/314_2.png) [@KristofKoch](https://forum.generic-mapping-tools.org/u/KristofKoch)\
**Post date:** [February 5, 2021, 8:52pm UTC](https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308/2 "2021-02-05T20:52:40Z")

</div>

Hi @Esteban82 have a look at [`mapproject -I`](https://docs.generic-mapping-tools.org/latest/mapproject.html#i). In combination with `-R...+r` this might do what you want if you feed it your required dimensions

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [February 5, 2021, 9:08pm UTC](https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308/3 "2021-02-05T21:08:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KristofKoch](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/kristofkoch/32/314_2.png) [@KristofKoch](https://forum.generic-mapping-tools.org/u/KristofKoch)\
**Post date:** [February 6, 2021, 2:12am UTC](https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308/4 "2021-02-06T02:12:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [February 6, 2021, 2:34am UTC](https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308/5 "2021-02-06T02:34:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [February 6, 2021, 2:52am UTC](https://forum.generic-mapping-tools.org/t/calculate-a-value-of-region-for-a-fixed-value-of-widht-heigth-and-projection/1308/6 "2021-02-06T02:52:59Z")

</div>

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.
