Recently I became aware of (and tested) the -g option (Segment data by detecting gaps). This is, as far as I know, just for plotting data.
Is there a utility that implements this functionality for data processing? I.e., instead of using -g I would like to preprocess my lines/data so that -g is unnecessary.
I feel like I’ve seen this before, but looking through the docs where I would assume such functionality to be described, I didn’t find anything, e.g. gmtspatial, gmtselect and gmtconnect (this seems to do the opposite - connect segments).
Segment headers always great things into segments and have no influence on optils like -g. The -g may add more segment headers as it detects those gaps.
Middle-upper is plot with -g - splits ut line segments good
Middle-lower is an attempt to get the result of the middle-upper plot (with -g) into a file for later use. This does produces lines, but many(/all) of the line segments are reduced to contain only one point, hence no lines are drawn. This is illustrated by the lower figure.
PS: s/-gd1000/-gD1000 cause crash (the command may not make sense, but a crash is a crash):
ERROR: Caught signal number 11 (Segmentation fault) at
[0x0]
[0x0]
Stack backtrace:
/home/anbj/gmt/build/lib/libgmt.so.6(sig_handler_unix+0x10a)[0x7fca63ce6071]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x13140)[0x7fca63b0a140]
plot [WARNING]: File <stdin> is empty!
I think your gmt convert -g stuff needs to be fed first vi mapproject -J etc since otherwise you are using the wrong units directly on the lon/lat data.
What if the file is already projected? In this case via proj.
The -g option should not care about where the data is coming from…?
Am I using wrong units in this case?
No problem @Esteban82; don’t we all… Confusing stuff.
Everything I’m using here is already in projected units (with proj); just to keep it as simple as possible.
From -g: d|D- define a gap when there is a large enough distance between coordinates (upper case to use projected coordinates).
This give to cases:
gap is big enough → impose breal
gap is not big enough → do not impose break
In my orignal plot, -gd was set too low, causing a ‘blank canvas’ (middle-lower); shouldn’t this just produce the same plot as the upper figure (‘plotted as-is’)?
Mmmm, with your previous values (-gd1000) you split all your data into single points and them ask GMT to plot lines (gmt plot -W). from them. I don’t think that makes sense. But, you could plot points as in the lowest figure.