GMTCONNECT(1gmt) | GMT | GMTCONNECT(1gmt) |
gmtconnect - Connect individual lines whose end points match within tolerance
gmtconnect [ table ] [ -C[closed] ] [ -D[template] ] [ -L[linkfile] ] [ -Q[template] ] [ -T[cutoff[unit][/nn_dist]] ] [ -V[level] ] [ -bbinary ] [ -dnodata ] [ -eregexp ] [ -fflags ] [ -ggaps ] [ -hheaders ] [ -iflags ] [ -oflags ] [ -:[i|o] ]
Note: No space is allowed between the option flag and the associated arguments.
gmtconnect reads standard input or one or more data files, which may be multisegment files, and examines the coordinates of the end points of all line segments. If a pair of end points are identical or closer to each other than the specified separation tolerance then the two line segments are joined into a single segment. The process repeats until all the remaining endpoints no longer pass the tolerance test; the resulting segments are then written out to standard output or specified output file. If it is not clear what the separation tolerance should be then use -L to get a list of all separation distances and analyze them to determine a suitable cutoff.
None.
For map distance unit, append unit d for arc degree, m for arc minute, and s for arc second, or e for meter [Default], f for foot, k for km, M for statute mile, n for nautical mile, and u for US survey foot. By default we compute such distances using a spherical approximation with great circles. Prepend - to a distance (or the unit is no distance is given) to perform "Flat Earth" calculations (quicker but less accurate) or prepend + to perform exact geodesic calculations (slower but more accurate).
The ASCII output formats of numerical data are controlled by parameters in your gmt.conf file. Longitude and latitude are formatted according to FORMAT_GEO_OUT, absolute time is under the control of FORMAT_DATE_OUT and FORMAT_CLOCK_OUT, whereas general floating point values are formatted according to FORMAT_FLOAT_OUT. Be aware that the format in effect can lead to loss of precision in ASCII output, which can lead to various problems downstream. If you find the output is not written with enough precision, consider switching to binary output (-bo if available) or specify more decimals using the FORMAT_FLOAT_OUT setting.
To combine the digitized segment lines segment_*.txt (whose coordinates are in cm) into as few complete lines as possible, assuming the end points slop could be up to 0.1 mm, run
gmt connect segment_*.txt -Tf0.1 > new_segments.txt
To combine the digitized segments in the multisegment file my_lines.txt (whose coordinates are in lon,lat) into as few complete lines as possible, assuming the end points slop could be up to 150 m, and write the complete segments to separate files called Map_segment_0001.dat, Map_segment_0002.dat, etc., run
gmt connect my_lines.txt -T150e -DMap_segment_%04d.dat
The line connection does not work if a line only has a single point. However, gmtconnect will correctly add the point to the nearest segment. Running gmtconnect again on the new set of lines will eventually connect all close lines.
gmt, gmt.conf, gmtsimplify, gmtspatial, mapproject
2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
May 21, 2019 | 5.4.5 |