Class: dijits.overview.OverviewMap
dojo.require("dijits.overview.OverviewMap");
Description
An overview map control shows the extent of the map it is associated with in the context of a larger area. It is typically smaller in size compared to the main map and updates itself whenever the main map extent changes. The extent of the main map is represented in the overview map area as a rectangle. This extent rectangle can be dragged to change the extent of the main map. In addition, the following features are available:
- attach the overview map to one of the corners of main map and hide it when not used
- render it in a div element outside of the main map
- maximize the overview map momentarily to the size of main map for quick access to faraway regions of interest
Class hierarchy
+------------------------------+
¦ Object ¦
+------------------------------+
Δ Δ
| |
| |
+----------------+ +--------------------+
¦ dijit._Widget ¦ ¦ dijit._Templated ¦
+----------------+ +--------------------+
Δ Δ
| |
| |
+-------------------------------+
¦ dijits.overview.OverviewMap ¦
+-------------------------------+
Constructor
new dijits.overview.OverviewMap( params, srcNodeRef? )
Creates a new overview map dijit using the given DOM node.
Arguments:
| params | Object | Various parameters to configure this dijit. See the list below for details. |
| srcNodeRef | DOMNode | String | Optional. Reference or id of a HTML element that this dijit is rendered into. The HTML element will be replaced by the dijit and the attachTo option described below will be ignored. In addition, the show/hide and maximize buttons will be hidden. |
The following parameters are supported:
| map | Map | Reference to the map object that this overview map control is associated with. This parameter is always required. |
| baseLayer | ArcGISTiledMapServiceLayer | ArcGISDynamicMapServiceLayer | Optional. Specifies the base layer for the overview map. Note that this layer must have already been loaded, that is, its loaded property must be true. If this option is not specified, a copy of the base layer of the main map will be used. |
| id | String | Optional. Unique identifier for this dijit. It can be later used with dijit.byId to get a reference to this dijit or used with dojo.byId to get a reference to the DOM node behind it. |
| width | Number | Optional. Width of the overview map control in screen pixels. Default value is 1/4th the width of the map, unless the HTML element referred to by the srcNodeRef argument has valid size. |
| height | Number | Optional. Height of the overview map control in screen pixels. Default value is 1/4th the height of the map, unless the HTML element referred to by the srcNodeRef argument has valid size. |
| attachTo | String | Optional. Specifies the map corner to which this overview map control is attached to. Valid values are: "top-right", "bottom-right", "bottom-left" and "top-left". Default is "top-right". |
| expandFactor | Number | Optional. Ratio between the size of the overview map and the extent rectangle shown on the overview map. Default value is 2, meaning, the overview map will be at least twice the size of the extent rectangle. |
| color | String | Optional. Fill color for the extent rectangle. Default value is "#000000". |
| opacity | Number | Optional. Opacity of the extent rectangle as a number between 0 (invisible) and 1 (opaque). Default value is 0.5. |
Methods
| Method | Return Value | Description |
|---|---|---|
| startup() | none | Finalizes the creation of this dijit. This method should be called after the constructor for this dijit is called and before letting the users interact with it. |
| destroy() | none | Releases all resources used by the dijit. This method should be called when an instance of this dijit is no longer needed in your application. |
Usage
Overview map with minimal configuration
var overviewMapDijit = new dijits.overview.OverviewMap({ map: map });
overviewMapDijit.startup();
Overview map with custom options
var overviewMapDijit = new dijits.overview.OverviewMap({
map: map,
baseLayer: layer,
id: "overview-map",
width: 300,
height: 250,
attachTo: "bottom-left",
expandFactor: 2.5,
color: "#FF0000",
opacity: 0.55
});
overviewMapDijit.startup();
Overview map rendered outside of the main map
JavaScript:
var overviewMapDijit = new dijits.overview.OverviewMap({ map: map }, dojo.byId("overviewmap_canvas"));
overviewMapDijit.startup();
HTML:
<div id="map_canvas"></div>
<div id="overviewmap_canvas" style="width: 300px; height: 200px;"></div>