CreateMap()

Summary

Create a new, empty map window.

Syntax

actual_name = CreateMap(string map_name, array options)

Argument Contents
map_name The name you want to use for the map
Option Type Contents
Activate Macro String The name of a macro that is called whenever the map is activated
Annotation Menu String The context menu when clicking on an annotation and only one annotation is selected
Annotations Menu String The context menu when clicking on an annotation and more than one annotation is selected
Auto Project Boolean If "True" the map projection is chosen automatically, based on the current scope and scale; if False projections are not automatically changed
Close Macro String The name of a macro called when the user closes the map from the system menu
Context Menu String The context menu when clicking on a map and not on annotations
Done Macro String The name of a macro that is called after the window is closed
Locked Boolean If "True" the Close option does not appear in the system menu; if "False" the Close option does appear
Menu String The menu associated with the map window
Position 2 integers The screen location of the window (x, y)
Scale Change Macro String The name of a macro called whenever the scale or scope of the map changes
Scope Scope The initial (default) scope of the map
Size 2 integers The screen size of the window (x, y)
Title String The map window title
Toolbar String The toolbar associated with the map window

Returns

A string containing the actual name of the map.

Notes

  • The scope option is required.

  • The map is empty until a layer or annotation is added.

  • The scale change macro runs whenever the map scale is changed. This can occur when appropriate functions are called (such as SetMapScope() or SetScale()) or when the user resizes or reshapes the map window.

  • The position and size of the map window are expressed as percentages of Maptitude's frame.

  • The attached menu and toolbar are automatically displayed whenever the map is activated.

  • If the menu, toolbar, activate macro, close macro, or scale change macro is not specified, CreateMap() uses the default specified with SetDefaults(). If a map-specific default was not specified with SetDefaults(), then CreateMap() uses the generic default.

Example

// Get the scope of a geographic file
folder = RunMacro("G30 Tutorial Folder")
info = GetDBInfo(folder + "states.cdf")
scope = info[1]
// Create a map using this scope
map = CreateMap("My Empty Map", {
{"Scope", scope},
{"Auto Project", "True"},
{"Position", 100, 150}
})

Error Codes

Error Type Meaning
Error Unable to create the map window

See Also

Function Summary
AddAnnotation() Adds an annotation to a map or layout window
AddCDFLayer() Adds a layer from a compact format geographic file to a map
AddImageLayer() Adds an image layer to a map
AddLayer() Adds a layer from a standard geographic file to a map
DuplicateMap() Creates a copy of a map
OpenMap() Open a map file and display it in a map window
SetDefaults() Sets default menus, toolbars, and macros.