FindMyNearest
 

FindMyNearest

Definition

DistancesFromPoint[] FindMyNearest ( string username, string password, LocationLicence licence, string point, string dataset, Option[] options )

Description:

Finds the location of a free-text address element, and the closest stores or other points of interest to that location. The location is returned as an array of DistancesFromPoint objects, each representing the location of one possible alternative location.

The point to find the nearest stores to should be supplied as the point parameter, and can be either a postcode or free-text address element such as town name or "street, town" etc.

The list of stores to find the nearest stores from must already be set up using the Find My Nearest data list editor. The name of the data list to use should be supplied as the dataset parameter.

By default, the three closest stores will be included in the result. This can be modified by supplying an Option with a name of MaxMatches and a value of the number of stores you want to retrieve.

View all Find My Nearest Methods

Code Samples

Language:

<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="http://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>

<script type="text/javascript">

function loadIntegr8() {
  // Load the Location Integr8 service
  data8.load('Location');
}

function FindMyNearest(licence, point, dataset) {
  /// <param name="licence">string. One of the following values: WebServer, WebClick, InternalUser, SmallUser, Lookup, InternalServer</param>
  /// <param name="point">string</param>
  /// <param name="dataset">string</param>
  var location = new data8.location();
  
  location.findmynearest(
    licence,
    point,
    dataset,
    null,
    showFindMyNearestResult
  );
}

function showFindMyNearestResult(result) {
  // Check that the call succeeded, and show the error message if there was a problem.
  if (!result.Status.Success) {
    alert('Error: ' + result.Status.ErrorMessage);
  }
  else {
    // TODO: Process method results here.
    // Results can be extracted from the following fields:
    // result.Distances
    //   Contains a list of the possible points that could have been intended by the user, and a list of the closest points in the Find My Nearest data set to each one, with the closest point first.
  }
}

loadIntegr8();

</script>
Skip Navigation Links
Request handled by server S1 for client 38.107.179.218 at 22/05/2012 23:11:11