[ Whereis® API Home ] [ Developers' Guide ] [ Controls ]

A zoomed image is one that seems to be magnified or reduced in size. The effect is achieved by maintaining a fixed window size and position, a fixed centre point, but switching the map to one that shows the area at a greater or lesser scale.

Scale on a paper map is presented in a ratio such as 1:250,000, meaning 1 unit on the map = 250,000 equivalent units on the ground. Zoom levels for an online map are provided – like a digital photograph – in terms of resolution.

With digital photography, each pixel represents some fixed area, but the size it translates to depends on the size of your screen and the quality of your graphics card. When dealing with maps, the 'size' question is complicated by the fact that we're measuring an expanse of the Earth, which is (more or less) spherical.

The EMS JavaScript API has designated 15 zoom levels (EMS.Zoom.MINIMUM to EMS.Zoom.MAXIMUM inclusively). Each level is calculated in terms of the degrees longitude that it represents. However, each degree longitude is a slightly different size, depending where on the globe it is measured. Even within Australia, the distance represented by a single degree longitude varies depending on where you happen to be.

To see the range of longitudinal values you can expect a pixel to represent at each zoom level and which zoom approximately corresponds to what scale of address (property, suburb, state, etc.), refer to the Appendix.

Methods

The following zoom methods are available on an existing Map object.

Name

Description

zoom()

Changes the zoom level of the map. Takes an integer or an EMS.Zoom value. These range between EMS.Zoom.MINIMUM and EMS.Zoom.MAXIMUM inclusively.

zoomToExtent()

Zooms the map to include the extent specified by an EMS.Bounds object

zoomToMaxExtent()

Zooms the map so that it shows all Australia

By default, the EMS map includes a ZoomBar, allowing the user to click and drag from one zoom level to another. Using MouseDefaults, a user can also zoom by double-clicking the map. In this case, the map zooms in by one level and also re-centres on the clicked point.

With KeyboardDefaults instantiated the user may also use plus (+) and minus (-) keys to zoom the map by one level in or out.

You can reference the ZoomBar as follows:

var control = map.getControlByClass("EMS.Control.ZoomBar");

Either depend on the default implementation, or instantiate the ZoomBar as follows:

map.addControl(new EMS.Control.ZoomBar());

The final Boolean values in the above example set the ZoomBar to dynamic in size.

NEXT PAGE

NOTES
Icon

ZoomBar is the only EMS control that you cannot add using the controls option within the map constructor. The map must exist before you can reference its layers!