[ Whereis® API Home ] [ Developers' Guide ] [ JS Services ]

For detailed information about suburbs, postcodes, regions and states you can use the Detail Service. The detail service will return the system ID for the searched item, as well as location details and geocode. Using the optional "levelOfDetail" parameter, one or more of the following additional information may be requested as well:

ADJACENTDetails of locations that share a boundary with the requested location
SUBDIVISONSDetails of locations within your requested location, as well as locations that contain your requested location
GEOMETRYPolygon geometry for the requested location. This data can be easily added to a Whereis Map

If the level of detail includes geometry, an additional "tolerance" parameter may be included as well. Setting a number for tolerance will simplify the response geometry in one metre increments. That is, a tolerance of 10 will simplify the geometry by removing unnecessary vectors that deviate from the geometry path by less than ten metres. Setting the tolerance too high will result in a two vector polygon.

To request a location detail, perform the following steps.

  1. Initialise the Geocoding service.
  2. Format the request.
  3. Submit the request, nominating a callback function
  4. Process the response within the callback function.

A successful request returns an EMS.Detail object

Sample request

The following code snippet retrieves the details for the suburb Richmond 3121.

//Initialise service
var service = new EMS.Service.Details();
//Format request
var query = {
    "suburb":"Richmond",
    "postcode":"3121",
    "levelOfDetail":["ADJACENT"]
}
//Submit request
service.search(query, callback);
//Handle the response
function callback (response, status){
// Check the status of the result is non-error
    if (status == EMS.Status.OK) {
       // Success! check the results
       var geocode = response.getGeocode();
       var msg = geocode.address.toString() + " (";
       msg += geocode.centerPoint.lon + ", ";
       msg += geocode.centerPoint.lat + ")";
       alert(msg);
    } else {
       // Error! Display the message.
       alert(response.message);
    }
}

Query format varies between location types, for example:

Suburb query:

{
    "suburb":<suburb name>,
    "postcode":<postcode>,
    "levelOfDetail": [], //optional
    "tolerance":<number> //optional
} 

Postcode query:

{
    "postcode":<postcode>,
    "levelOfDetail": [], //optional
    "tolerance":<number> //optional
}

Region query:

{
    "regionName":<regionName>,
    "state":<state name>,
    "levelOfDetail": [], //optional
    "tolerance":<number> //optional
}

State query:

{
    "state":<state name>,
    "levelOfDetail": [] //optional
}

NEXT PAGE

NOTES

Full details of request and response object parameters are set out in the EMS JSON API

Icon

The JSON API uses Australian English. The parameter documented as "centrePoint" must be retrieved through the JavaScript API as "centerPoint".

Icon

Remember that all points must be passed in and are returned in WGS84 format. For the EMS JavaScript API to centre on, or otherwise manipulate, a returned point, convert the coordinates to their EMS.LonLat equivalent.

Icon

For more information, refer to JavaScript Command Reference and examples.