[ Whereis® API Home ] [ Developers' Guide ]
When you create the map, you can optionally include a hash table of options to define initial properties, such as the map's centre point and zoom level. In conjunction with the map's size in pixels - as set by the div - these two properties determine exactly which area of Australia will be visible and at what resolution.
var map = new EMS.Map("map-div", {
"zoom": EMS.Zoom.SUBURB,
"center": new EMS.LonLat(144.96291, -37.813585)
});
Within the constructor you can also specify a list of map controls (such as ZoomBar), the map type (street, photo or hybrid - a combination of the two), and/or a callback function to which the map object should be passed once initialised.
For a list of available options, refer to the JavaScript Command Reference.
Methods
Once the Map object has been instantiated, available methods include the following.
Name | Description |
addControl() | adds a control to an existing map. |
destroy() | removes a map and clear all resources it has used. |
getExtent() | returns an EMS.Bounds object which specifies the geographical area shown on the map, defined by its EMS.LonLat coordinates. If WGS84 coordinates are required, use map.getExtent().asWGS84(), which returns an OpenLayers.Bounds object with WGS84 coordinates. |
isValidLonLat() | tests that current map coordinates are non-null and valid for use with the API |
setCenter() | sets a new centre point, expressed as an EMS.LonLat object, and a new zoom level. |
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. |
If you pass setCenter() a set of coordinates outside the mappable area, the API will reject them without returning an error.