Track value next location point

Hello everyone, I am facing a problem that I can not solve. I have a map with gravimetric data on land and sea, I want to draw a profile as on the map with in x the longitude and in y the variation of g in mGal at 44°15’ altitude. My problem is that I would like to take into consideration all the points close to this profile with a defined distance and export them to a new text file for plotting. Does anyone have an idea, how I can do this with gmt or matlab ?

This must be some sort of gravity season. It’s the 4rth time (for me) today that a different gravity issue comes up. But digression aside, you should be able to do it a collaboration of gmtspatial -Sb (create a buffer) and gmtselect to extract the data points that lie inside the buffer.

Isn’t any time gravity time?

Thank you very much for your answer, after reading the documentation I did not find the -Sb option, it seems that I have to use the -A[amin_dist][unit] option (Perform spatial nearest neighbor (NN) analysis). However I really don’t see how I can proceed to ask it to find the closest points to my profile at 44°15’ latitude. Knowing that my input file is in xyz format, i.e. longitudes, latitudes and values in mGal. I want to specify that I am a beginner on gmt ! Thanks for your help and your time.

Hi Andreas, unfortunately I don’t have a time column in my file !

Seems to me this is a job for gmt project -W.

That’s because you are using an old GMT version. It’s generally not a good idea to ask for help and not helping ourselves by having the latest version. GMT is very dynamic :slight_smile:

Sorry about that. I am actually using the latest version and the documentation is linked to the latest version, and I found this option -Sh in documentation not -Sb, maybe it is a typo. I have read the explanation of the option -Sh but I don’t know how to get the desired result.

This is what GMT6.4 manual shows. The command will be gmtspatial file_with_line_ccordinate -Sb0.01 to create a buffer with approximately 2 km width. But see Paul’s suggestion, maybe that’s what you are after (we cannot know).

-S b width|h|i|j|s|u

Spatial processing of polygons. Choose from -Sb width which computes a buffer polygon around lines, -Sh which identifies perimeter and hole polygons (and flags/reverses them), -Si which returns the intersection of polygons (closed), -Su which returns the union of polygons (closed), -Ss which will split polygons that straddle the Dateline, and -Sj which will join polygons that were split by the Dateline. Note1: Only -Sb, -Sh and -Ss have been implemented. Note2: -Sb is a purely Cartesian operation so width must be in data units. That is, for geographical coordinates width must be provided in degrees or, preferably, project data into an equal-area projection, compute the buffer and then convert back to geographical.

1 Like

I’m really sorry, I worked all night last night and I was very tired and I didn’t realize that I was on the Project module documentation and not gmtspatial, that’s why I couldn’t find the -Sb option. Thanks for your answer and your precious help I will focus on your suggestion and try to find how I can solve this.

Thanks for the suggestion, I’ll take a closer look to see what I can find.