Managing Individual Layer Properties and Appearance - 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

The following clauses affect layers. Layer properties are optional in the Set Map statement.

Syntax

Set Map 
	[ Window window_id ] 
	[ Layer layer_id 
		[ Time [begin start_expr [(start_time_expr] )]
			[end end_expr [{(end_time_expr)} | {duration “time_unit”} ]
			[extents [begin time_value] [end time_value] ]
			[ignore null] [add null]
			[interval count “time_unit”]
			[clear]]
		[ LAYER_ACTIVATE_CLAUSES ]
		[ Editable { On | Off } ]
		[ Selectable { On | Off } ] 
		[ Zoom ( min_zoom, max_zoom ) 
			[ Units dist_unit ] [ { On | Off } ] ] 
		[ Arrows { On | Off } ]
		[ Centroids { On | Off } ]
		[ Default Zoom ]
		[ Nodes { On | Off } ]
		[ Inflect num_inflections [ by percent ] at
			color:value [ , color:value ]
			[ Round rounding_factor ] ]
		[ Contrast contrast_value ]
		[ Brightness brightness_value ]
		[ {Alpha alpha_value } | { Translucency translucency_percent } ]
		[ FriendlyName layer_name ]
		[ Filter Where expr [None | On] ]
		[ Filter None ]
		[ Filter On]
	]
	[ Transparency { Off | On } ]
	[ Color transparent_color_value ]
	[ GrayScale { On | Off } ]
	[ Relief { On | Off } ]
	[ LABEL_CLAUSES ]
	[ LAYER_OVERRIDE_CLAUSES ]
	[ Display { Off | Graphic | Global } ] 
	[ Global Line... ] [ , Line...] ...
	[ Global Pen... ] [ , Pen...] ...
	[ Global Brush... ] [ , Brush...] ...
	[ Global Symbol... ] [ , Symbol...] ...
	[ Global Font... ] [ , Font...] ...

window_id is the integer window identifier of a Map window.

layer_id identifies which layer to modify; can be a SmallInt (for example, use 1 to specify the top map layer other than Cosmetic) or a string representing the name of a table displayed in the map.

start_expr is a date, time, or datetime expression – usually an indexed column. Used to build a query for the layer’s table that will overlap the maps current time period.

start_time_expr is a time expression – usually a column. Only valid if start_expr is of type date.

end_expr is a date, time, datetime, or numeric expression – usually an indexed column. Used to build a query for the layer’s table that will overlap the maps current time period. If this represent a duration then it must be a numeric expression.

end_time_expr is a time expression – usually a column. Only valid if end_expr is of type date.

duration is only valid if an end_time is not specified. It represents the duration of the time event.

count is the number of time units to use when calculating time periods on map.

time_unit is the time unit, see list of time units.

time_value is a date, time, or datetime value – the type needs to match to the start time or end time settings

Ignore null will exclude null values from column in time period query.

Add null will include null values from column in time period query.

LAYER_ACTIVATE_CLAUSES is a shorthand notation, not a MapBasic Keyword. See Layer Activate Clause described under Managing Hotlinks.

min_zoom is a numeric expression, identifying the minimum zoom at which the layer will display.

max_zoom is a numeric expression, identifying the maximum zoom at which the layer will display.

dist_unit is a string expression, specifying the units for the map (such as "mi" for miles, "m" for meters; see Set Distance Units statement for a list of available unit names). This is an optional parameter. If not present, the distance units from the table's coordinate system are used.

num_inflections is a numeric expression, specifying the number of color:value inflection pairs used in a Grid theme.

color is an expression of color using the RGB( ) function.

value is an inflection that is displayed in the paired color.

rounding_factor is a numeric expression, specifying the rounding factor applied to the inflection values.

contrast_value a value of 0 to 100 representing contrast. This value corresponds to the slider on the Grid Appearance dialog box, which is available when modifying a grid theme from the Modify Thematic Map dialog box.

brightness_value a value of 0 to 100 representing brightness. This value corresponds to the slider on the Grid Appearance dialog box, which is available when modifying a grid theme from the Modify Thematic Map dialog box.

we never describe the contrast_value or brightness_value arguments. They are both numbers from 0 to 100, which specify contrast and brightness; these correspond to the sliders in the Grid Appearance dialog box, which is accessible when you use the Modify Thematic Map dialog box to modify a Grid theme.

alpha_value is an integer value representing the alpha channel value for translucency. Values range from 0-255. 0 is completely transparent. 255 is completely opaque. Values between 0-255 make the image layer display translucent.

translucency_percent is an integer value representing the percentage of translucency for a vector, raster, or grid image layer. Values range between 0-100. 0 is completely opaque. 100 is completely transparent.

Note: Specify either Alpha or Translucency but not both, since they are different ways of specifying the same result. If you specify multiple keywords, the last value will be used.

layer_name is a pretty (friendly) name to apply to a map layer. This name displays in MapInfo Pro in place of the layer table name. The string is a maximum of 255 characters and cannot be empty. Using "Default" as the string, clears the friendly name.

The Filter Where clause applies filter condition to a layer in a map. The syntax after the Where keyword is like a SQL Select Where clause. When you apply a filter, the thematic applied on the layer is refreshed, but the bins are not recalculated.

None will turn off the filter on the map layer.

On will turn on the filter on the map with previous where expression. If Filter On is specified without any previous filter condition map will be empty.
Note: When Filter is applied on the map an internal hidden table is created.

You can use the LayerInfo(<mapId>, <layerNum>, LAYER_INFO_FILTER_TABLE_ALIAS) to get the alias of the hidden filter table.

A Hidden filter table cannot be closed by the user. I also cannot persist in the workspace.
For example, the statement below will apply a Filter on the map layer 1 with the specified condition:
Set Map Layer 1 Filter Where State="TX"
Set Map Layer 1 Filter Where State="TX" None 'This will turn off the filter but 
							set the expression.
Set Map Layer 1 Filter On  'This will turn on the filter with previous expression.
Set Map Layer 1 Filter None 'This will turn off the filter

transparent_color_value a specific color value. Transparency allows raster image layers to display in a transparent mode where pixels of a certain color (transparent_color_value) do not draw.

LABEL_CLAUSES is a shorthand notation, not a MapBasic keyword, see Managing Individual Label Properties.

LAYER_OVERRIDE_CLAUSES is a shorthand notation, not a MapBasic keyword, see Adding Style Overrides to a Layer.

Description

Time sets the time related properties of the map layer.
‘single date column named RPT_DT 
Set Map Window 3002 Layer 1 Time Begin RPT_DT 

‘single date expression 
Set Map Window 3002 Layer 1 Time Begin StringToDate(RPT_DT_string_col, "yyyy.MM.Dd", "en-US")  

‘separate date and time columns named RPT_DT and RPT_TIME 
Set Map Window 3002 Layer 1 Time Begin RPT_DT End RPT_TIME 

‘start and end columns 
Set Map Window 3002 Layer 1 Time Begin Committed_on_from_Date End  

‘start and end columns 
Set Map Window 3002 Layer 1 Time Begin Committed_on_from_Date End Committed_to_Date 

‘sepaarate start and end date and time columns 
Set Map Window 3002 Layer 1 Time Begin Committed_on_from_Date (Committed_on_from_Time) 
	end Committed_to_Date (Committed_to_Time) 

‘single datetime column with duration 
Set Map Window 3002 Layer 1 Time Begin RPT_DTTM End DurationCol Duration “Hr” 

‘single datetime column with extents and interval 
Set Map Window 3002 Layer 1 Time Begin RPT_DTTM Extents Begin "20110806120000000" 
	end "20110906115959000" Interval 1 "Hr" 

‘resets all time settings for the layer to default and set time configuration to None for the layer 
Set Map Window 3002 Layer 1 Time Clear 

Editable sets the Editable attribute for the appropriate Layer. At any given time, only one of the mapper's layers may have the Editable attribute turned on. Note that turning on a layer's Editable attribute automatically turns on that layer's Selectable attribute. The following Set Map statement turns on the Editable attribute for first non-cosmetic layer:

	Set Map
		Layer 1 Editable On

Selectable sets whether the given layer should be selectable through operations such as Radius-Search. Any or all of the Map layers can have the Selectable attribute on. The following Set Map statement turns on the Selectable attribute for the first non-cosmetic map layer, and turns off the Selectable attribute for the second and third map layers:

	Set Map
		Layer 1 Selectable On
		Layer 2 Selectable Off
		Layer 3 Selectable Off

Zoom configures the zoom-layering of the specified layer. Each layer can have a zoom-layering range; this range, when enabled, tells MapInfo Pro to only display the Map layer when the map's zoom distance is within the layering range. The following statement sets a range of 0 to 10 miles for the first non-Cosmetic layer.

	Set Map
		Layer 1 Zoom (0, 10) Units "km" On 

The On keyword activates zoom layering for the layer. To turn off zoom layer, specify Off instead.

Arrows turns the display of direction arrows on or off.

Centroids turns the display of centroids on or off.

Inflect overrides the inflection color:value pairs that are stored in the grid (.MIG) file.

Nodes turns the display of nodes on or off.

Relief turns relief shading for a grid on or off. The grid must have relief shade information calculated for it for this clause to have any effect. Relief shade information can be calculated for a grid with the Relief Shade statement.

Display controls how the objects in the layer are displayed. When you specify Display Off, the layer does not appear in the Map. When you specify Display Graphic, the layer's objects appear in their default style, as saved in the table. When you specify Display Global, all objects appear in the global styles assigned to the layer. These global styles can be assigned through the optional Global sub-clauses. The following statement displays layer 1 with green line and fill styles:

	Set Map 
		Layer 1 Display Global 
		Global Line(1, 2, GREEN)
		Global Pen (1, 2, GREEN) 
		Global Brush (2, GREEN, WHITE) 

Global Line specifies the style used to display line and polyline objects. A Line clause is identical to a Pen clause, except for the use of the keyword Line instead of Pen.

Global Pen is a valid Pen clause that specifies the style used to display the borders of filled objects.

Global Symbol is a valid Symbol clause that specifies the style used to display point objects.

Global Brush is a valid Brush clause that specifies the style used to display filled objects.

Global Font is a valid Font clause that specifies the font used to display text objects.

The Global clauses support stacked styles as a comma separated list of like style clauses. For example, the following displays points with a global stacked symbol style:

Set Map Layer 1 Display Global Global Symbol (32,16777136,24), 
Symbol (36,255,14)

The following statement adds a global stacked line style to a layer:

Set Map Layer 1 Display Global
Zoom (0, 10000) Units "mi"
Global Line (4, 193, 16711680), Line (2, 193, 16711680)