EMS : Developers' Guide

[ Whereis® API Home

This documentation guides you through some of the core functionality available from our JavaScript Library. If you plan to do anything more than put a simple map on a webpage, check out the Location Readme before you begin.

Hello Map

When you insert a map with the JavaScript API, you're inserting a fully interactive component with its own user interface: effectively a mini-application operating inside your web page.

All that with little more than a line of code.

1. Include the EMS API. You'll need your token for authentication.

<script type="text/javascript"
 src="<ENDPOINT>/web/js/ems/?token=####################"></script>

 2. Insert a div somewhere in the HTML to display the map.

<div id="MapDiv"></div>

3. Write a one-line function - this one runs when the page loads.

<script type="text/javascript">
    window.onload = function() {
        var map = new EMS.Map("MapDiv");
    }
</script>

The default map shows the whole of Australia (zoom=0) and is sized to fit the current browser window. It has a full set of controls, including mouse and keyboard controls, and scalebar, copyright symbol, northing arrow, ZoomBar, panning arrows, a keymap, "map" and "photo" buttons.

NEXT PAGE

NOTES

If you have not yet been provided with a token and password, please contact ems-support@ems.sensis.com.au.

 

Icon

When you retrieve a map via the JavaScript API, it is always initialised in relation to an HTML div.The attributes of the div determine the attributes of the map it contains - so use CSS to adjust the map's size.

<div id="map-div" style="width:800px; height:400px;"></div>

Icon

For more information, see the following working example:

  • Simple map