Maptitude GISDK Help

AddLink()

Summary

Adds a line feature to a line layer.

 

Changes

Node IDs option added to Version 5.0. "Snap From Node" and "Snap To Node" options added to Version 6.0/2012.

 

Syntax

new_id = AddLink(array line_coordinates, integer ID, array options)

 

Argument Contents
line_coordinates An array defining the geographic coordinates of the line feature
ID The ID of the new line, or null to generate an ID automatically

 

Option Type Contents
Snap Node Boolean "True" if the endpoints of the line should be snapped to other line endpoints in the geographic file; "False" (the default) for no node snapping; equivalent to passing the same value for both the Snap From Node and Snap To Node options described below
Snap Link Boolean "True" if any existing lines close to the new line's endpoints should be split and snapped together with the new line; "False" (the default) for no line snapping
Snap From Node Boolean "True" if the 'from' node of the link should be snapped to other line endpoints in the geographic file; "False" (the default) for no snapping of the 'from' node
Snap To Node Boolean "True" if the 'to' node of the link should be snapped to other line endpoints in the geographic file; "False" (the default) for no snapping of the 'to' node
Node IDs Two Integers Connects the nodes with IDs id1 and id2
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 of 3 elements:

 

Element Type Contents
1 Integer The ID of the added line
2 Integer The ID of the From node
3 Integer The ID of the To node

 

Notes

Example

// Add a line to an editable street file

SetLayer("Street")

on escape do Return() end

st_coords = ClickPolyline()

new_id = AddLink(st_coords, , )

ShowMessage("The new line feature has an ID of " + String(new_id[1]))

 

Error Codes

Error Type Meaning
Error The current layer is not a line layer, or is not from a standard geographic file; or ID is already in use

 

See Also

Function Summary
DeleteLink() Deletes a line feature from an area layer
ReverseLink() Reverses the order of shape points on a link

 

 

©2025 Caliper Corporation www.caliper.com