OpenMap()

Summary

Opens a map file and displays it in a map window.

Syntax

map_name = OpenMap(string path, array options)

Argument Contents
path The path and file name of the map file
Option Type Contents
Activate Macro String The name of a macro that is called whenever the map window is activated
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
Done Macro String The name of a macro that is called after the window is closed
Force Directory String The path that will be used to look for layers used in the map file, before any of the other locations they would usually be searched for (including the location the files were in when the map was saved)
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 title, shown on the window title bar
Toolbar String The toolbar associated with the map window

Returns

A string containing the name of the map window.

Notes

  • OpenMap() opens files created by SaveMap().

  • The scale change macro runs whenever the map scale is altered. This occurs 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 the Maptitude 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, OpenMap() uses the default specified with SetDefaults(). If a map specific default was not specified with SetDefaults() then OpenMap() uses the generic default.

Example

folder = RunMacro("G30 Tutorial Folder")
mp1 = OpenMap(folder + "nesouth.map", {
{"Auto Project", "True"}
})

Error Codes

Error Type Meaning
Error The path and file name are unspecified
NotFound The map file does not exist

See Also

Function Summary
CloseMap() Closes a map window
DuplicateMap() Creates a copy of a map
OpenMap() Opens a map file and displays it in a map window
CreateMap() Creates a new, empty map window.
SaveMap() Saves settings for a map window to a file on disk
SetDefaults() Sets default menus, toolbars, and macros.