Objects Intersect 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

Erases any portions of the target object(s) that do not overlap the selection; corresponds to choosing the Erase Outside Target command on the SPATIAL tab. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Objects Intersect Into Target
	[ Concurrency { All | Aggressive | Intermediate | Moderate | None } ]
	[ Data column_name = expression [ , column_name = expression ... ] ]
	[ DropIndex ( Auto | On | Off ) ]

column_name is a string representing the name of a column in the table being modified.

expression is an expression used to determine what is erased from the column_name columns.

Description

The Objects Intersect statement erases part or all of the object(s) currently designated as the editing target. Using the Objects Intersect statement is equivalent to choosing MapInfo Pro's Erase Outside Target command on the SPATIAL tab. For an introduction to using the Erase Outside Target command, see the MapInfo Pro User Guide.

The optional Concurrency clause lets you distribute the processing to multiple cores to improves performance. When Concurrency is set to none and the machine has more than one core, then the other cores are left unused. This clause lets you specify the level of concurrency needed to perform this operation on the map. Concurrency can have one of the following values:
  • All: Full concurrency. All processors on your system perform the operation. This is the default setting MapInfo Pro installs with.
  • Aggressive: Aggressive concurrency, 75% of the processors on your system perform the operation.
  • Intermediate: Intermediate concurrency, 50% of the processors on your system perform the operation.
  • Moderate: Moderate concurrency, 25% of the processors on your system perform the operation.
  • None: No concurrency. A single processor performs the operation. This option provides the least amount of processing speed.

In addition to the five possible concurrency values, you can also specify the number of cores to use, such as eight (8). If your computer has less than the specified number of cores, MapBasic defaults to using all available cores on that machine. Specifying zero (0), a negative number, or invalid text that is different from the five possible concurrency values causes an error.

The optional Data clause controls what values are stored in the columns of the target objects. The Data clause can contain a comma-separated list of column assignments. Each column assignment can take one of the forms listed in the following table:

Assignment Effect
col_name = col_name
MapBasic does not alter the value stored in the column.
col_name = value
MapBasic stores a specific value in the column. If the column is a character column, the value can be a string; if the column is a numeric column, the value can be a number.
col_name = Proportion( col_name )
Used only for numeric columns; MapBasic reduces the number stored in the column in proportion to how much of the object's area was erased. Thus, if the operation erases half of the area of an object, the object's column value is reduced by half.

The Data clause can contain an assignment for every column in the table. If the Data clause only specifies assignments for some of the columns, MapBasic assigns blank values to those columns that are not listed in the Data clause. If you omit the Data clause entirely, MapBasic blanks out all columns of the target objects, storing zero values in numeric columns and blank values in character columns.

Specifying that the DropIndex clause is On suspends updating transaction indexes while executing the operation and recreates them when the operation is complete. In some cases this significantly improves performance, but not always. For the best performance, we recommend setting this clause to Auto, so that MapInfo Pro decides whether or not to suspend and recreate indexes. MapInfo Pro will suspend and recreate indexes later if the operation is deleting or updating the rows and the table contains more than 1000 rows and more than 0.1% of the total rows are getting updated. When the DropIndex clause is Off the operation executes without suspending and recreating the transaction indexes.

The Objects Intersect statement is very similar to the Objects Erase statement, with one important difference: Objects Intersect erases the parts of the target objects(s) that do not overlap the current selection, while the Objects Erase statement erases the parts of the target object. For each Target object, a new object is created for each area that intersects a cutter object. For example, if a target object is intersected by three cutter objects, then three new objects will be created. The parts of the target that lie outside all cutter objects will be discarded. For more information, see Objects Erase statement.

Example

Objects Intersect Into Target 
	Data 
		Field2=Proportion(Field2)

Using the Concurrency clause:

Objects Intersect Into Target 
	Concurrency All Data...

See Also:

Create Object statement, IntersectNodes() function, Overlap() function, Objects Erase statement