# Intersection between line and map border

**URL:** <https://forum.generic-mapping-tools.org/t/intersection-between-line-and-map-border/6296>\
**Category:** Q&A\
**Tags:** gmt\
**Created:** [December 2, 2025, 8:13pm UTC](https://forum.generic-mapping-tools.org/t/intersection-between-line-and-map-border/6296 "2025-12-02T20:13:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EvanPi](https://avatars.discourse-cdn.com/v4/letter/e/e47774/32.png) [@EvanPi](https://forum.generic-mapping-tools.org/u/EvanPi)\
**Post date:** [December 2, 2025, 8:13pm UTC](https://forum.generic-mapping-tools.org/t/intersection-between-line-and-map-border/6296/1 "2025-12-02T20:13:41Z")

</div>

I have a map using an oblique region, defined by `-R-104.98/-4.549/-104.82/-4.548+r` with projection `-JOA-104.9/-4.56/100.5/7i` and a line that goes off the map. Is it possible to find the intersection between the (west) edge of the map and this line? I essentially need to be able to extract the coordinates of the lower left and upper left corners of the map and then use `gmt spatial line.txt westborder.txt -Ie`, but I have not figured out how to get the upper left corner. The closest I have been able to get is `gmt mapproject -R$region -J$Jparam -Wr`, but that doesn’t actually give the region I desire (not the bounding meridians), not to mention that it gives the meridians in 0-360 units and not -180-180…

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [December 2, 2025, 8:37pm UTC](https://forum.generic-mapping-tools.org/t/intersection-between-line-and-map-border/6296/2 "2025-12-02T20:37:06Z")

</div>

What about `mapproject -WE`?

---

<div class="post-metadata">

**Author:** ![EvanPi](https://avatars.discourse-cdn.com/v4/letter/e/e47774/32.png) [@EvanPi](https://forum.generic-mapping-tools.org/u/EvanPi)\
**Post date:** [December 2, 2025, 8:47pm UTC](https://forum.generic-mapping-tools.org/t/intersection-between-line-and-map-border/6296/3 "2025-12-02T20:47:40Z")

</div>

That just returns my original region (but in 0-360 format):  
`-R255.0200000000099/-4.54900000000183/255.180000000001/-4.548000000000185+r `  
Interestingly, it appears that this introduces a very small but of numerical error.

---

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [December 2, 2025, 9:21pm UTC](https://forum.generic-mapping-tools.org/t/intersection-between-line-and-map-border/6296/4 "2025-12-02T21:21:32Z")

</div>

`mapproject -We+n2`

should return a closed rectangle with all 4 corner coordinates. choose your corner.
