Maptitude GISDK Help |
In standard Maptitude you use commands and tools to set the center and scale of the map. With GISDK, you set the map scale and center using a scope. A scope is a compound variable with four parts that defines the portion of the world covered by a map:
Part |
Contents |
Center |
A coord (another compound variable) containing the longitude and latitude of the the center of the area |
Width |
The horizontal extent of the area in world units (see SetMapUnits()) |
Height |
The vertical extent of the area in world units |
Projection |
An array containing the projection name and other parameters |
The following GISDK functions are used to create and use scopes:
GISDK Function |
Summary |
Awaits user input from the system pointer, accepts an ellipse, and returns a scope |
|
Awaits user input from the system pointer, accepts a rectangle whose center is a valid world point, and returns a scope |
|
Awaits user input from the system pointer, accepts a rectangle, and returns a scope |
|
Converts a customized image file into a map snapshot |
|
Returns the scope of an array of coordinates |
|
Gets summary information about a geographic file |
|
Gets information about a raster image file |
|
Gets the scope of a layer |
|
Gets coordinates at the four corners of a map |
|
Gets the default scope of a map |
|
Gets the scope of a map |
|
Gets the scope of a map using the current window width and height |
|
Returns a valid scope for a particular projection |
|
Gets the scope of a given record on the current layer |
|
Gets coordinates at the four corners of a given scope |
|
Gets an array of two coordinates that define the rectangle of a scope |
|
Gets the scope of the features in a selection set |
|
Gets the scope of a view |
|
Creates a scope |
|
Sets the default scope of a map |
|
Sets the area covered by a map |
The following functions are used to get information that can be used to create a scope for geographic file formats that can be displayed directly:
GISDK Function |
Summary |
Gets information about an Esri (ArcView) Shapefile |
|
Collects summary information on the contents of a MapInfo TAB file |
|
Gets information about an ODBC layer |
|
Gets information about an Oracle Spatial table |
When you create a map using CreateMap(), you assign a scope to the map so that Maptitude knows which portion of the world the map covers. This becomes the default scope for the map. You can then use SetMapScope() to change the area covered by the map. You can also update the default scope of a map and retrieve this default scope using SetMapDefaultScope() and GetMapDefaultScope().
The following example creates a new map that shows an entire geographic file, and then zooms in on a particular map feature:
// First, get the scope of the Connecticut Sales Region geographic file
folder = RunMacro("G30 Tutorial Folder")
db = folder + "ctsales.cdf"
db_info = GetDBInfo(db)
db_scope = db_info[1]
// Now create a map... |
|
map1 = CreateMap("My First Map", { |
// the name of the map |
{"Scope", db_scope}, |
|
// the default scope |
|
{"Menu", default_menus}}) |
|
// what menus are attached to the window |
|
AddLayer(map1, "Regions", db, "Regions") |
// Add the region layer to the map |
RedrawMap(map1) |
// Draw the map at its initial scale... |
qry = "Select where Name = 'Fairfield'" |
// Select a particular sales region.... |
SelectByQuery("Selection", "several", qry) |
|
set_scope = GetSetScope("Selection") |
// Get the scope of the record(s) in the |
// selection set |
|
SetMapScope(map1, set_scope) |
|
RedrawMap(map1) |
// Redraw the map once again |
SetMapScope(map1, GetMapDefaultScope(map1)) |
// Restore the scope to the |
// original value |
|
RedrawMap(map1) |
You can also control the scale and center of a map using the following GISDK functions:
GISDK Function |
Summary |
Centers a map at a particular location |
|
Allows the user to pan a map by dragging it to a new position |
|
Gets the scale of a map |
|
Sets the area covered by a map to be that shown before the last change in scale or scope |
|
Controls whether map windows redraw automatically |
|
Sets the scale of a map |
|
Changes the scale and center of a map |
|
Changes the scale of a map |
GISDK provides additional functions for comparing, merging, and testing the overlap of scopes and points. These GISDK functions are as follows:
GISDK Function |
Summary |
Checks to see if a coordinate is in a given scope |
|
Checks to see if one scope is completely contained within another |
|
Creates a scope that is the intersection of the input scopes |
|
Checks to see if one scope overlaps another |
|
Creates a scope that encompasses the entire area covered by two input scopes |
Note that when you set the scope of a map, Maptitude makes sure that the entire scope you requested is shown on the screen. The exact scale that results depends upon the shape of the map window. For example, if your map window is very short and wide, but your scope has equal width and height, Maptitude automatically centers the scope in the window, and fills in the left and right sides of the map with geographic data that are outside the scope. The GetMapScope() GISDK function returns the last scope you set, regardless of the shape of the map window. Use GetMapWindowScope() when you want to determine the actual scope that is displayed in the map window.
©2025 Caliper Corporation | www.caliper.com |