Create Collection 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

Combines points, linear objects, and closed objects into a single object. The collection object displays in the Browser as a single record. You can issue this statement from the MapBasic window in MapInfo Pro.

Syntax

Create Collection [ num_parts ]
	[ Into { Window window_id | Variable var_name } ] 
	Multipoint
		[ num_points ]
		( x1, y1 ) ( x2, y2 ) [ ... ]
		[ Symbol... ]
	Region
		num_polygons
		[ num_points1 ( x1, y1 ) ( x2, y2 ) [ ... ] ]
		[ num_points2 ( x1, y1 ) ( x2, y2 ) [ ... ] ... ]
		[ Pen... ]
		[ Brush... ]
		[ Center ( center_x, center_y ) ]
	Pline
		[ Multiple num_sections ]
		num_points
		( x1, y1 ) ( x2, y2 ) [ ... ]
		[ Pen... ]
		[ Smooth... ]

num_parts is the number of non-empty parts inside a collection. This number is from 0 to 3 and is optional for MapBasic code (it is mandatory for MIF files).

num_polygons is the number of polygons inside the Collection object.

num_sections specifies how many sections the multi-section polyline will contain.

Pen is a valid Pen clause to specify a line style.

Brush is a valid Brush clause to specify fill style.

Example

create collection multipoint 2 (0,0) (1,1) region 3 3 (1,1) (2,2) (3,4) 4 
(11,11) (12,12) (13,14) (19,20) 3 (21,21) (22,22) (23,24) pline 3 (-1,1) 
(3,-2) (4,3)
dim a as object
create collection into variable a multipoint 2 (0,0) (1,1) region 1 3 
(1,1) (2,2) (3,4) pline 3 (-1,1) (3,-2) (4,3)
insert into test (obj) values (a)
create collection region 2 4 (-5,-5) (5,-5) (5,5) (-5,5) 4 (-3,-3) (3,-3) 
(3,3) (-3,3) pline multiple 2 2 (-6,-6) (6,6) 2 (-6,6) (6,-6) multipoint 6 
(2,2) (-2,-2) (2,-2) (-2,2) (4,1) (-1,-4)

See Also:

Create MultiPoint statement, Set Combine Version statement