JoinLinks()

Summary

Joins two line features that meet at a common endpoint.

Syntax

new_ids = JoinLinks(integer ID1, integer ID2, array options)

Argument Contents
ID1 The ID of the first line feature
ID2 The ID of the second line feature
Option Type Contents
Reason String If provided, a record will be added to the database's log file, with this used as the Reason column. If it's not provided, no entry will be added, even if the other options are present.
Comment String Text for the comment field of the log file.
User String User name for the log file.

Returns

An array containing the integer ID of the new line feature and the integer ID of the endpoint between the two links.

Notes

  • JoinLinks() can only be used on the line layer of a standard geographic file.

  • The line layer must be the current layer.

  • The two input lines must share a common endpoint.

  • JoinLinks() does not eliminate the common endpoint. You are left with an orphan node with no attached links. You can use DeleteNode() to actually delete the node.

  • The log file name will have the same name as the database and a .txt extension.

Example

// Select two links and join them
a_pt = ClickCoord()
b_pt = ClickCoord()
SetLayer("Highway")
a_id = RH2ID(LocateNearestRecord(a_pt, 0.25))
b_id = RH2ID(LocateNearestRecord(b_pt, 0.25))
on error do
ShowMessage("The links don't share an endpoint!")
Return()
end
ids = JoinLinks(a_id, b_id)

Error Codes

Error Type Meaning
Error The current layer is not a line layer, or is not from a standard geographic file; the two lines do not share an endpoint; or ID1 and ID2 are the same
NotFound One or both of the IDs is invalid

See Also

Function Summary
DeleteNode() Deletes an endpoint feature from a standard geographic file
MoveNode() Changes the location of an endpoint feature in a standard geographic line file
SplitLink() Splits a link into two parts at a given coordinate