Combine() function - 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

Returns a region or polyline representing the union of two objects. The objects cannot be Text objects. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

Combine( object1, object2 )

object1, object2 are two object expressions; both objects can be closed (e.g., a region and a circle), or both objects can be linear (e.g., a line and a polyline)

Return Value

An object that is the union of object1 and object2.

Description

The Combine() function returns an object representing the geographical union of two object expressions. The union of two objects represents the entire area that is covered by either object.

The Combine() function has been updated to allow heterogeneous combines, and to allow Points, MultiPoints, and Collections as input objects. Previously, both objects had to be either linear objects (Lines, Polylines, or Arcs) and produce Polylines as output; or both input objects had to be closed (Regions, Rectangles, Rounded Rectangles, or Ellipses) and produce Regions as output. Heterogeneous combines are not allowed, as are combines containing Point, MultiPoint and Collection objects. Text objects are still not allowed as input to Combine().

MultiPoint and Collection objects, introduced in MapInfo Pro 6.5, extend the Combine operation. The following table details the possible combine options available and the output results:

Input Object Type Input Object Type OutputObject Type
Point or MultiPoint Point or MultiPoint MultiPoint
Linear (Line, Polyline, Arc) Linear Polyline
Closed (Region, Rectangle, Rounded Rectangle, Ellipse) Closed Region
Point, MultiPoint, Linear, Closed, Collection Point, MultiPoint, Linear, Closed, Collection Collection

The results returned by Combine() are similar to the results obtained by choosing MapInfo Pro's Combine command (on the SPATIAL tab), except that the Combine command modifies the original objects; the Combine() function does not alter the object1 or object2 expressions. Also, the Combine() function does not perform data aggregation.

The object returned by the Combine() function retains the styles (e.g., color) of the object1 parameter when possible. Collection objects produced as output will get those portions of style that are possible from object1, and the remaining portions of style from objects2. For example, if object1 is a Region and object2 is a Polyline, then the output collection will use the brush and border pen of object1 for the Region style contained in the collection, and the pen from object2 for the Polyline style in the collection.

See Also:

Brush clause, Objects Combine statement, Pen clause, Set Combine Version statement