FindServiceSoap.FindNearby Method

FindServiceSoap.FindNearby Method

Finds points of interest within a specified distance of a given latitude and longitude coordinate; for example, restaurants within a certain distance of an address. Valid data sources include MapPoint Web Service data sources with a CanFindNearby capability (DataSourceCapability enumeration), and your own data uploaded for use with MapPoint Web Service. Returns an array of found points of interest ordered by proximity to a selected point, the top score, the number of results found, and the index into the array of results, as a FindResults object. Maximum returned value is 500. Default number of returned results is 25.


Public Function FindNearby (ByVal specification As FindNearbySpecification)  As FindResults


[C#]

public FindResults FindNearby (FindNearbySpecification specification);

Parameters

  • specification
    The specifications of the find nearby request (FindNearbySpecification object), including the point around which to search, the radius of the search area, the entity type, properties, and values to match, the results range to return, the search context, a flag to identify which objects are desired in the returned results, and the data source to search in.

Remarks

  • The FindNearby method is valid only with data sources that have a CanFindNearby capability (DataSourceCapability enumeration). This includes several MapPoint Web Service point-of-interest data sources, as well as your custom data source if you have uploaded location data to the MapPoint Web Service servers by using the MapPoint Web Service Customer Services site (https://mappoint-css.live.com/CSCV3/) or the Customer Data Service upload methods.

  • For more information about MapPoint Web Service data sources, see MapPoint Web Service Data Sources and Capabilities.

  • To retrieve a list of data sources and their capabilities, use the CommonServiceSoap.GetDataSourceInfo method.

  • For information about using your own data with MapPoint Web Service, see the Help topic Prepare location data for uploading in the MapPoint Web Service Customer Services site (https://mappoint-css.live.com/CSCV3/).

  • If no results are found, the returned FindResults.NumberFound property value is 0.

  • For information about becoming a customer, visit the MapPoint Web Service Web site.

Example

[Visual Basic]

'Output a property value (the phone number) for each 
'MapPoint.FourthCoffeeSample store nearby
Dim findService As New FindServiceSoap()
Dim findNearbySpec As New FindNearbySpecification()
findNearbySpec.DataSourceName = "MapPoint.FourthCoffeeSample"
findNearbySpec.Distance = 1
findNearbySpec.LatLong = New LatLong()
findNearbySpec.LatLong.Latitude = 47.6
findNearbySpec.LatLong.Longitude = -122.33
findNearbySpec.Filter = New FindFilter()
findNearbySpec.Filter.EntityTypeName = "FourthCoffeeShops"

Dim foundResults As FindResults
foundResults = findService.FindNearby(findNearbySpec)
Console.WriteLine("Fourth Coffee Shop Store List")
Dim fr As FindResult
For Each fr In foundResults.Results
 Console.WriteLine(fr.FoundLocation.Entity.Name + ": " _
       + fr.FoundLocation.Entity.Properties(6).Value.ToString())
Next



[C#]
 
//Output a property value (the phone number) for each 
//MapPoint.FourthCoffeeSample store nearby
FindServiceSoap findService = new FindServiceSoap();
FindNearbySpecification findNearbySpec  = new FindNearbySpecification();
findNearbySpec.DataSourceName = "MapPoint.FourthCoffeeSample";
findNearbySpec.Distance = 1;
findNearbySpec.LatLong = new LatLong();
findNearbySpec.LatLong.Latitude = 47.6;
findNearbySpec.LatLong.Longitude = -122.33;
findNearbySpec.Filter = new FindFilter();
findNearbySpec.Filter.EntityTypeName = "FourthCoffeeShops";

FindResults foundResults;
foundResults = findService.FindNearby(findNearbySpec);
Console.WriteLine("Fourth Coffee Shop Store List");
foreach(FindResult fr in foundResults.Results)
{
 Console.WriteLine(fr.FoundLocation.Entity.Name + ": "
  + fr.FoundLocation.Entity.Properties[6].Value.ToString());

}


See Also

  FindServiceSoap Class   |   DataSourceCapability Enumeration   |   FindResults Class   |   FindNearbySpecification Class