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

The Points of Interest (POI) service returns a list of points of interest for a given area defined by a bounding box.

Sample request

The following code snippet returns a list of POIs by category name:

//Initialise service
service = new EMS.Service.Poi();

//Format request
var request = {};
request.category = "atms";
request.bounds = {"left":"144.96","bottom":"-37.817","right":"144.962","top":"-37.815"};

//Submit request
service.browse(request, 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 items = response.results;
       if (items.length > 0) {
           var msg = "";
           for (var i = 0; i < results.length; i++) {
               msg += results[i].name + " " + "<br>" ;
           }
           alert(msg);
       } else {
          // Found nothing
       }
    } else {
       // Error! Display the message.
       alert(response.message);
    }
};

NEXT PAGE

NOTES

Full details of request and response object parameters are set out in the 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 the following: