Use GMT to extract the intersection lat, lon point coordinates for the earth relief shorelines with an arbitrary specified grid

Hi all,

I’m quite new to GMT and is wondering if it is somehow possible to use GMT to extract the lat, lon point coordinates (in text/ASCII format) for the earth relief shorelines where they intersect with an arbitrary specified grid.

Example:
Shoreline grid input: earth_relief_15m.grd
If I want to get the intersection points between the lines given in the above file and the lat, lon gridlines in the area -30/50/30/75 with 0.5 deg lat/lon resolution, are there options in GMT to do this?

Frank, I think you are looking for grdtrack but your question is very confuse. The earth_relief_15m.grd is not a Shoreline grid and a grid does not have lines (as implied by your sentence …between the lines given in the above file)

Hi again,

Thanks for your response, I will try to clarify:

With regards to the files earth_relief_xxx.grd my understanding till now has been that these files contain the point coordinates to draw the shorelines (with different resolution) within GMT. If this understanding is wrong I apologize for the confusion! Anyhow, what I am trying to catch is the intersection point coordinates between:

  1. A geometry file containing the shorelines (in whichever suitable format for GMT).
  2. The “imaginary” lat, lon. lines passing through an arbitrary regular grid (which is not uncommonly included in a plotted map).

For further clarification an example plot may help, intersection points indicated by red colored points:

I hope this helps :slightly_smiling_face:

Thanks!

Ah. No, earth_relief_xxx.grd are earth relief grids. Nothing to do with the gridlines in a map.
You can save coastlines with pscoast -M option. Then you need to manually create another file with your map gridlines (you know their coordinates). Finally use gmtspatial, see the penultimate example in it’s man page.

Hi again,

further to this topic I am trying to set up a GMT code for establish a gridfile defining an “offset shoreline” (i.e. a shoreline with arbitrary offset on the oceans side, not on the land side, to the real shoreline), see the leaflet example plot below.

By reading examples in the manual which seems suitable for the purpose as e.g. “(35) Spherical triangulation and distance calculations” I can’t quite grasp how this is achievable for a single line.

Assuming GMT can be used to perform the task, will it be a requirement to use a geometry inputfile with GSHHG data (with polygon info) or is it possible to use any ASCII gridfile with xy-coordinates describing the shoreline?

Hi, Frank
For your question, you can see here(please use a language translater):


The code and data are available in the post.

Hi yangleir, and thanks a lot for your example! I think this may help me out on the issue since I haven’t found a final solution to it yet using other sources (so I have been struggling with the issue the last couple of weeks). Think I will try to make a similar script based on your input :slight_smile: .