[ 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:
| ADJACENT | Details of locations that share a boundary with the requested location |
| SUBDIVISONS | Details of locations within your requested location, as well as locations that contain your requested location |
| GEOMETRY | Polygon 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.
- Initialise the Geocoding service.
- Format the request.
- Submit the request, nominating a callback function
- 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
}