Purpose
Cleans the objects from the given table, and optionally performs various topology-related operations on the objects, including snapping nodes from different objects that are close to each other into the same location and generalization/thinning. The table may be the Selection table. All of the objects to be cleaned must either be all linear (for example, polylines and arcs) or all closed (for example, regions, rectangles, rounded rectangles, or ellipses). Mixed linear and closed objects cannot be cleaned in one operation, and an error will result. You can issue this statement from the MapBasic window in MapInfo Pro.
Syntax
Objects Snap From tablename
[ Tolerance [ Node node_distance ] [ Vector vector_distance ]
[ Units unit_string] ]
[ Thin [ Bend bend_distance ] [ Distance spacing_distance ]
[ Units unit_string ] ]
[ Cull Area cull_area [ Units unit_string ] ] ]
tablename is a string representing the name of the table of the objects to be checked.
node_distance is a number representing a radius around the end points nodes of a polyline.
vector_distance is a number representing a radius used for internal nodes of polylines.
bend_distance is a number representing the co-linear tolerance of a series of nodes.
spacing_distance is a number representing the minimum distance a series of nodes in the same object can be to each other without being removed.
unit_string is a string representing the distance units to be used.
cull_area is a number representing the threshold area within which polygons are culled.
unit_string is a string representing the area units to be used.
Description
The objects from the input tablename are checked for various data problems and inconsistencies, such as self-intersections. Self-intersecting regions in the form of a figure 8 will be changed into a region containing two polygons that touch each other at a single point. Regions containing spikes have the spike portion removed. The resulting cleaned object replaces the original input object. If any overlaps exist between the objects they are removed. Removal of overlaps generally consists of cutting the overlapping portion out of one of the objects, while leaving it in the other object. The region that contains the originally overlapping section consists of multiple polygons. One polygon represents the non-overlapping portion, and a separate polygon represents each overlapping section.
The Node and Vector Tolerances values snap nodes from different objects together, and can be used to eliminate small overlaps and gaps between objects. The Units sub-clause of Tolerances lets you specify a distance measurement name (such as "km" for kilometers) to apply to the Node and Vector values. If the Units sub-clause is not present, then the Node and Vector values are interpreted in MapBasic's current distance unit. By default, MapBasic uses miles as the distance units; to change this unit, use the Set Distance Units statement.
The Node tolerance is a radius around the end point nodes of a polyline. If there are nodes from other objects within this radius, then one or both of the nodes will be moved such that they will be in the same location (for example, they will be snapped together).
The Vector tolerance is a radius used for internal nodes of polylines. Its purpose is the same as the Node tolerance, except it is used only for internal (non-end point) nodes of a polyline. Note that for Region objects, there is no explicit concept of end point nodes, since the nodes form a closed loop. For Region objects, only the Vector tolerance is used, and it is applied to all nodes in the object. The Node tolerance is ignored for Region objects. For Polyline objects, the Node tolerance must be greater than or equal to the Vector tolerance.
The Bend and Distance values can be used to help thin or generalize the input objects. This reduces the number of nodes used in the object while maintaining the general shape of the object. The Units sub-clause of Thin lets you specify a distance measurement name (such as "km" for kilometers) to apply to the Bend and Distance values. If the Units sub-clause is not present, then the Bend and Distance values are interpreted in MapBasic's current distance unit.
The Bend tolerance is used to control how co-linear a series of nodes can be. Given three nodes, connect all of the nodes in a triangle. Measure the perpendicular distance from the second node to the line connecting the first and third nodes. If this distance is less than the Bend tolerance, then the three nodes are considered co-linear, and the second node is removed from the object.
The Distance tolerance is used to eliminate nodes within the same object that are close to each other. Measure the distance between two successive nodes in an object. If the distance between them is less than the Distance tolerance, then one of the nodes can be removed.
The Cull Area value is used to eliminate polygons from regions that are smaller than the threshold area. The Units sub-clause of Cull lets you specify an area measurement name (such as "sq km" for square kilometers) to apply to the Area value. If the Units sub-clause is not present, then the Area value is interpreted in MapBasic's current area unit. By default, MapBasic uses square miles as the area unit; to change this unit, use the Set Area Units statement.
Example
Open Table "STATES.TAB" Interactive
Map From STATES
Set Map Layer 1 Editable On
select * from STATES
Objects Snap From Selection Tolerance Node 3 Vector 3 Units "mi" Thin Bend
0.5 Distance 1 Units "mi" Cull Area 10 Units "sq mi"