The following clauses affect the current view-in other words, where the map is centered, and how large an area is displayed in the Map window.
Syntax
Set Map
[ Window window_id ]
[ Center ( longitude, latitude ) [ Smart Redraw ] ]
[ Zoom {
zoom_distance [ Units dist_unit ] | Entire
[ Layer layer_id | Selection] | Tileserver Layer layer_id} ]
[ Pan pan_distance [ Units dist_unit ]
{ North | South | East | West } [ Smart Redraw ] ]
[ Scale screen_dist [ Units dist_unit ] For map_dist
[ Units dist_unit ] ]
window_id is the integer window identifier of a Map window.
longitude, latitude is the new center point of the map.
zoom_distance is a numeric expression dictating how wide an area to 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.
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.
pan_distance is a distance to pan the map.
screen_dist and map_dist specify a map scale (for example, screen_dist = 1 inch, map_dist = 1 mile).
Description
Center controls where the map will be centered within the Map window. For example: New York City is located (approximately) at 74 degrees West, 41 degrees North. The following Set Map statement centers the map in the vicinity of New York City. Coordinates are specified in decimal degrees, not Degrees/Minutes/Seconds.
Set Map Center (-74.0, 41.0)
A Set Map Center statement causes the entire window to redraw, unless you include the optional Smart Redraw clause. For details on Smart Redraw, see below (under Pan).
Pan moves the Map window's view of the map. For example, the following statement moves the map view 100 kilometers north:
Set Map Pan 100 Units "km" North
Ordinarily, the Set Map...Pan statement redraws the entire Map window. If you include the optional Smart Redraw clause, MapInfo Pro only redraws the portion of the map that needs to be redrawn (as if the user had re-centered the map using the window scrollbars or the Grabber tool).
Set Map Pan 100 Units "km" North Smart Redraw
Scale zooms in or out so that the map has the scale you specify. For example, the following statement zooms the map so that one inch on the screen shows an area ten miles across.
Set Map Scale 1 Units "in" For 10 Units "mi"
Zoom dictates how wide an area should be displayed in the Map. For example, the following statement adjusts the zoom level, to display an area 100 kilometers wide.
Set Map Zoom 100 Units "km"
If the Zoom clause includes the keyword Entire, then MapInfo Pro zooms the map to show all objects in a map layer, all selected objects in a map layer, or all objects in all map layers:
The following example shows all of layer 2:
Set Map Zoom Entire Layer 2
The following example shows all selected objects in a map layer:
Set Map Zoom Entire Selection
The following example shows the whole map:
Set Map Zoom Entire
When specifying the Selection keyword with the Zoom clause and there is no selection, a dialog displays the message “No records were selected.” When the selection layer is not visible, a dialog displays the message “Selection layer needs to be visible.” (The Selection keyword also works with seamless tables.)
The Tileserver token requires the Layer clause to be specified.
Set Map Window FrontWindow() Zoom Tileserver Layer
is invalid as layer_id is missing.Set Map Window FrontWindow() Zoom Tileserver Layer 1