Platform: Not Platform Related
Add Map Statement - Description
How is the Add Map Statement used?
Adds another layer to a Map window.
[ Window window_id ]
[ Auto ]
Layer table [ , table ... ]
[ Animate ]
window_id is the window identifier of a Map window
table is the name of a mappable, open table to add to a Map window
The Add Map statement adds one or more open tables to a Map window. MapInfo then automatically redraws the Map window, unless the redraws have been suppressed through a Set Event Processing Off statement or Set Map...Redraw Off statement.
The window_id parameter is an Integer window identifier representing an open Map window; a window identifier can be obtained by calling the FrontWindow() and WindowID() functions. If the Add Map statement does not specify a window_id value, the statement affects the topmost Map window.
If the optional Auto keyword is included, MapInfo tries to automatically position the map layer at an appropriate place in the set of layers. A raster table or a map of region objects would be placed closer to the bottom of the map, while a map of point objects would be placed on top.
If the Auto keyword is omitted, the specified table becomes the topmost layer in the window; in other words, when the map is redrawn, the new table layer will be drawn last. Then, use the Set Map statement to alter the order of layers in the Map window.
Adding Layers of Different Projections
If the layer added is a raster table, and the map does not already contain any raster map layers, the map adopts the coordinate system and projection of the raster image. If a Map window contains two or more raster layers, the window dynamically changes its projection, depending on which image occupies more of the window at the time.
If the layer added is not a raster table, MapInfo continues to display the Map window using whatever coordinate system and projection were used before the Add Map statement, even if the table specified is stored with a different native projection or coordinate system. When a table's native projection differs from the projection of the Map window, MapInfo converts the table coordinates "on the fly" so that the entire Map window appears in the same projection. Note: When MapInfo converts map layers in this fashion, map redraws take longer, since MapInfo must perform mathematical transformations while drawing the map.
Using Animation Layers to Speed Up Map Redraws
If the Add Map statement includes the Animate keyword, the added layer becomes a special layer known as the animation layer. When an object in the animation layer is moved, the Map window redraws very quickly, because MapInfo only redraws the one animation layer.
For an example of animation layers, see the sample program ANIMATOR.MB.
The following example opens a table (Vehicles) and makes the table an animation layer:
Open Table "vehicles" Interactive
Add Map Layer vehicles Animate
If the Add Map statement specifies two or more layers and it includes the Animate keyword, the first layer named becomes the animation layer, and the remaining layers are added to the map as conventional layers.
To terminate the animation layer processing, issue a Remove Map ... Layer Animate statement.
Animation layers have special restrictions. For example, users cannot use the Info tool to click on objects in an animation layer. Also, each Map window can have only one animation layer. For more information about animation layers, see the MapBasic User's Guide, Chapter 6.
Open Table "world"
Map From world
Open Table "cust1992" As customers
Open Table "lead1992" As leads
Add Map Auto Layer customers, leads
Working with map layers.