Objects Clean statement - 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

Cleans the objects from the given table, and optionally removes overlaps and gaps between regions. The table may be the Selection table. All objects to be cleaned must be closed object types (for example, regions, rectangles, rounded rectangles, or ellipses). You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Objects Clean From tablename	
	[ Overlap ]
	[ Gap Area [ Unit Units ] ]

tablename is a string representing the name of a table.

Units is a value of an area.

Description

The objects in the input tablename are first checked for various data problems and inconsistencies, such as self-intersections, overlaps, and gaps. 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 will have the spike portion removed. The resulting cleaned object will replace the original input object.

If the Overlap keyword is included, then overlapping areas will be removed from regions. The portion of the overlap will be removed from all overlapping regions except the one with the largest area.

Note: Objects Clean removes the overlap when one object is completely inside another. This is an exception to the rule of "biggest object wins". If one object is completely inside another object, then the object that is inside remains, and a hole is punched in the containing object. The result does not contain any overlaps.

Gaps are enclosed areas where no region object currently exists. In a boundary table, most regions abut other regions and share a common boundary. Just as there should be no overlaps between the regions, there should also be no gaps between the regions. In some cases, both these boundary gaps and holes are legitimate for the data. An example of this would be the Great Lakes in the World map, which separate parts of Canada from the USA. Most gaps that are data problems occur because adjacent boundaries do not have common boundaries that completely align. These gap areas are generally small.

To help weed out the legitimate gap areas, such as the Great Lakes, from problem gap areas, a Gap Area is used. Any potential gap that is larger than this gap area is discarded and not reported. The units of the Gap Area are indicated by the Units sub-clause. If the Units sub-clause is not present, then the Gap Area value is interpreted in MapBasic's current area unit. Gaps that are found will be removed by combining the area defining the gap to the region with the largest area that touches the gap. To help determine a reasonable Gap Area, use the Objects Check statement. Any gaps that the Objects Check statement flags will be removed with the Objects Clean statement.

Example

Open Table "STATES.TAB" Interactive
Map From STATES
Set Map Layer 1 Editable On
select * from STATES
Objects Clean From Selection Overlap Gap 10 Units "sq m"