FitObjects - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Fits objects to its neighboring objects; corresponds to choosing Spatial > Edit > Fix/Clean > Fit Objects. This function requires the MapCAD Tool and can be executed via the Exec() command. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

Exec("MapCAD.mbx","FitObjects",Tolerance, DistanceUnit, ReferenceLayer, AddNodes)

Return Value

Logical If an object cannot be fitted or the function failed, the return value=FALSE.

Description

Use the FitObjects function to fit all selected objects to their neighboring objects in a reference layer. Each selected object is considered, node by node, with neighboring nodes and edges from reference objects.

If close to the source node a reference node is found, the source node is moved to the reference node. If close to the source node a matching edge (without nodes) is found, the source node is aligned to the reference edge. In addition, a new node can be inserted into all found reference edges at the matching point.

The MapCAD tool must be loaded. This function requires no active map window.
Parameters Description
Tolerance Float value, circle radius around each node to search for matching reference object nodes and edges.
DistanceUnit String value, distance unit for geographic operations (e.g., "mi") according to the Set Distance Units statement.
ReferenceLayer String value, layer name of the layer that contains the neighboring objects.
AddNodes Logical value, If TRUE and the reference layer is writable, new nodes are inserted into all found reference edges at the match point.

Examples

'Fit all selected objects to its neighboring objects in layer Lakes. 
'The maximum distance between the nodes or edges is 0.03 miles. 
'New nodes are inserted at the matching points into all reference edges.
Dim Result as logical 
Result = Exec("MapCAD.mbx","FitObjects",0.03,"mi","Lakes","T")