.\" Man page generated from reStructuredText. . .TH "GMTCONNECT" "1gmt" "May 21, 2019" "5.4.5" "GMT" .SH NAME gmtconnect \- Connect individual lines whose end points match within tolerance . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp \fBgmtconnect\fP [ \fItable\fP ] [ \fB\-C\fP[\fIclosed\fP] ] [ \fB\-D\fP[\fItemplate\fP] ] [ \fB\-L\fP[\fIlinkfile\fP] ] [ \fB\-Q\fP[\fItemplate\fP] ] [ \fB\-T\fP[\fIcutoff\fP[\fIunit\fP][/\fInn_dist\fP]] ] [ \fB\-V\fP[\fIlevel\fP] ] [ \fB\-b\fPbinary ] [ \fB\-d\fPnodata ] [ \fB\-e\fPregexp ] [ \fB\-f\fPflags ] [ \fB\-g\fPgaps ] [ \fB\-h\fPheaders ] [ \fB\-i\fPflags ] [ \fB\-o\fPflags ] [ \fB\-:\fP[\fBi\fP|\fBo\fP] ] .sp \fBNote:\fP No space is allowed between the option flag and the associated arguments. .SH DESCRIPTION .sp \fBgmtconnect\fP 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 \fB\-L\fP to get a list of all separation distances and analyze them to determine a suitable cutoff. .SH REQUIRED ARGUMENTS .sp None. .SH OPTIONAL ARGUMENTS .INDENT 0.0 .TP .B \fItable\fP One or more ASCII (or binary, see \fB\-bi\fP[\fIncols\fP][\fItype\fP]) data table file(s) holding a number of data columns. If no tables are given then we read from standard input. .UNINDENT .INDENT 0.0 .TP \fB\-C\fP[\fIclosed\fP] Write all the closed polygons to \fIclosed\fP [gmtconnect_closed.txt] and all other segments as they are to stdout. No connection takes place. Use \fB\-T\fP\fIcutoff\fP to set a minimum separation [0], and if \fIcutoff\fP is > 0 then we also explicitly close the polygons on output. .UNINDENT .INDENT 0.0 .TP \fB\-D\fP[\fItemplate\fP] For multiple segment data, dump each segment to a separate output file [Default writes a single multiple segment file]. Append a format template for the individual file names; this template \fBmust\fP contain a C format specifier that can format an integer argument (the segment number); this is usually %d but could be %08d which gives leading zeros, etc. Optionally, it may also contain the format %c \fIbefore\fP the integer; this will then be replaced by C (closed) or O (open) to indicate segment type. [Default is gmtconnect_segment_%d.txt]. Note that segment headers will be written in either case. For composite segments, a generic segment header will be written and the segment headers of individual pieces will be written out as comments to make it possible to identify where the connected pieces came from. .UNINDENT .INDENT 0.0 .TP \fB\-L\fP[\fIlinkfile\fP] Writes the link information to the specified file [gmtconnect_link.txt]. For each segment we write the original segment id, and for the beginning and end point of the segment we report the id of the closest segment, whether it is the beginning (B) or end (E) point that is closest, and the distance between those points in units determined by \fB\-T\fP\&. .UNINDENT .INDENT 0.0 .TP \fB\-Q\fP[\fItemplate\fP] Used with \fB\-D\fP to a list file with the names of the individual output files. Optionally, append a filename template for the individual file names; this template \fBmay\fP contain a C format specifier that can format an character (C or O for closed or open, respectively). [Default is gmtconnect_list.txt]. .UNINDENT .INDENT 0.0 .TP \fB\-T\fP[\fIcutoff\fP[\fIunit\fP][/\fInn_dist\fP]] Specifies the separation tolerance in the data coordinate units [0]; append distance unit (see UNITS). If two lines has end\-points that are closer than this cutoff they will be joined. Optionally, append /\fInn_dist\fP which adds the requirement that a link will only be made if the second closest connection exceeds the \fInn_dist\fP\&. The latter distance must be given in the same units as \fIcutoff\fP\&. However, if no arguments are given then we close every polygon regardless of the gap between first and last point. .UNINDENT .INDENT 0.0 .TP \fB\-V\fP[\fIlevel\fP] (more ...) Select verbosity level [c]. .UNINDENT .INDENT 0.0 .TP \fB\-bi\fP[\fIncols\fP][\fBt\fP] (more ...) Select native binary input. [Default is 2 input columns]. .UNINDENT .INDENT 0.0 .TP \fB\-bo\fP[\fIncols\fP][\fItype\fP] (more ...) Select native binary output. [Default is same as input]. .UNINDENT .INDENT 0.0 .TP \fB\-d\fP[\fBi\fP|\fBo\fP]\fInodata\fP (more ...) Replace input columns that equal \fInodata\fP with NaN and do the reverse on output. .UNINDENT .INDENT 0.0 .TP \fB\-e\fP[\fB~\fP]\fI"pattern"\fP \fB|\fP \fB\-e\fP[\fB~\fP]/\fIregexp\fP/[\fBi\fP] (more ...) Only accept data records that match the given pattern. .UNINDENT .INDENT 0.0 .TP \fB\-f\fP[\fBi\fP|\fBo\fP]\fIcolinfo\fP (more ...) Specify data types of input and/or output columns. .UNINDENT .INDENT 0.0 .TP \fB\-g\fP[\fBa\fP]\fBx\fP|\fBy\fP|\fBd\fP|\fBX\fP|\fBY\fP|\fBD\fP|[\fIcol\fP]\fBz\fP[+|\-]\fIgap\fP[\fBu\fP] (more ...) Determine data gaps and line breaks. .UNINDENT .INDENT 0.0 .TP \fB\-h\fP[\fBi\fP|\fBo\fP][\fIn\fP][\fB+c\fP][\fB+d\fP][\fB+r\fP\fIremark\fP][\fB+r\fP\fItitle\fP] (more ...) Skip or produce header record(s). .UNINDENT .INDENT 0.0 .TP \fB\-i\fP\fIcols\fP[\fB+l\fP][\fB+s\fP\fIscale\fP][\fB+o\fP\fIoffset\fP][,\fI\&...\fP] (more ...) Select input columns and transformations (0 is first column). .UNINDENT .INDENT 0.0 .TP \fB\-o\fP\fIcols\fP[,...] (more ...) Select output columns (0 is first column). .UNINDENT .INDENT 0.0 .TP \fB\-:\fP[\fBi\fP|\fBo\fP] (more ...) Swap 1st and 2nd column on input and/or output. .UNINDENT .INDENT 0.0 .TP \fB\-^\fP or just \fB\-\fP Print a short message about the syntax of the command, then exits (NOTE: on Windows just use \fB\-\fP). .TP \fB\-+\fP or just \fB+\fP Print an extensive usage (help) message, including the explanation of any module\-specific option (but not the GMT common options), then exits. .TP \fB\-?\fP or no arguments Print a complete usage (help) message, including the explanation of all options, then exits. .UNINDENT .SH UNITS .sp For map distance unit, append \fIunit\fP \fBd\fP for arc degree, \fBm\fP for arc minute, and \fBs\fP for arc second, or \fBe\fP for meter [Default], \fBf\fP for foot, \fBk\fP for km, \fBM\fP for statute mile, \fBn\fP for nautical mile, and \fBu\fP for US survey foot. By default we compute such distances using a spherical approximation with great circles. Prepend \fB\-\fP to a distance (or the unit is no distance is given) to perform "Flat Earth" calculations (quicker but less accurate) or prepend \fB+\fP to perform exact geodesic calculations (slower but more accurate). .SH ASCII FORMAT PRECISION .sp 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 (\fB\-bo\fP if available) or specify more decimals using the FORMAT_FLOAT_OUT setting. .SH EXAMPLES .sp 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 .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt connect segment_*.txt \-Tf0.1 > new_segments.txt .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .sp 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 .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C gmt connect my_lines.txt \-T150e \-DMap_segment_%04d.dat .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .SH BUGS .sp The line connection does not work if a line only has a single point. However, \fBgmtconnect\fP will correctly add the point to the nearest segment. Running \fBgmtconnect\fP again on the new set of lines will eventually connect all close lines. .SH SEE ALSO .sp gmt, gmt.conf, gmtsimplify, gmtspatial, mapproject .SH COPYRIGHT 2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe .\" Generated by docutils manpage writer. .