FindServiceSoap.FindNearRoute Method

FindServiceSoap.FindNearRoute Method

Finds points of interest within a specified distance from a route. The found results are returned as a FindResults object.


Public Function FindNearRoute_
    (ByVal specification As FindNearRouteSpecification) As FindResults

[C#]

public FindResults FindNearRoute  (FindNearRouteSpecification specification);

Parameters

  • specification
    The specifications of the find near route request (FindNearRouteSpecification object), including the data source name, entity type name, distance and a route object. The find option properties SearchContext and ThresholdScore have no effect on this method.

Remarks

  • The maximum allowable distance to find points of interest from a route is 25 miles (40.2336 km).

  • The minimum distance allowed to find points of interest from a route is 0.1 mile (0.160934 km).

  • Maximum number of points of interest returned are 500.

  • The default sort order is as follows:

    1. First the results are sorted based on the distance from the origin of the route.

    2. Then the results are sorted based on the distance from the route.

    3. Finally, the results are again sorted on Entity IDs.

    The FindNearRoute method is only valid with customer specified points of interest data sources (and the MapPoint.FourthCoffeeSample data source) that have the find nearby capability. For more information about MapPoint Web Service data sources, see MapPoint Web Service Data Sources and Capabilities.

Example

[Visual Basic]

Dim findServiceSoap As FindServiceSoap = New FindServiceSoap
    findServiceSoap.Credentials = _
        New NetworkCredential(myMapPointUserId, mySecurePassword)
    Dim routeServiceSoap As RouteServiceSoap = New RouteServiceSoap
    routeServiceSoap.Credentials = _
        New NetworkCredential(myMapPointUserId, mySecurePassword)

    Dim latLongs As LatLong() = New LatLong() {New LatLong, New LatLong}
    latLongs(0).Latitude = 52.5
    latLongs(0).Longitude = 13.1
    latLongs(1).Latitude = 52.51
    latLongs(1).Longitude = 13.11
    Dim route As Route = _
        routeServiceSoap.CalculateSimpleRoute(latLongs, _
                                                "MapPoint.EU", _
                                            SegmentPreference.Quickest)
    Dim findNearRouteSpecification As FindNearRouteSpecification = _
                                        New FindNearRouteSpecification
    findNearRouteSpecification.DataSourceName = "MapPoint.FourthCoffeeSample"
    findNearRouteSpecification.Filter = New FindFilter
    findNearRouteSpecification.Filter.EntityTypeName = "FourthCoffeeShops"
    findNearRouteSpecification.Distance = 20.0
    findNearRouteSpecification.Route = route
    Dim findResults As FindResults = _
                findServiceSoap.FindNearRoute(findNearRouteSpecification)



[C#]
  
FindServiceSoap findService = new FindServiceSoap();
   findService.Credentials = 
    new System.Net.NetworkCredential(myMapPointUserId, mySecurePassword);

   RouteServiceSoap routeService = new RouteServiceSoap();
   routeService.Credentials = 
    new System.Net.NetworkCredential(myMapPointUserId, mySecurePassword);
 
   //Route between two locations
   LatLong[] latLongs = new LatLong[2];
   latLongs[0] = new LatLong();
   latLongs[1] = new LatLong();
   latLongs[0].Latitude = 52.5;
   latLongs[0].Longitude = 13.1;
   latLongs[1].Latitude = 52.51;
   latLongs[1].Longitude = 13.11;

   Route myRoute = 
    routeService.CalculateSimpleRoute(latLongs, 
              "MapPoint.EU", SegmentPreference.Quickest);

   FindNearRouteSpecification findnearroutespec = 
            new FindNearRouteSpecification();

   findnearroutespec.DataSourceName = "MapPoint.FourthCoffeeSample";
   findnearroutespec.Filter = new FindFilter();
   findnearroutespec.Filter.EntityTypeName = "FourthCoffeeShops";
   findnearroutespec.Distance = 20;
   findnearroutespec.Route = myRoute;

   FindResults foundResults;
   foundResults = findService.FindNearRoute(findnearroutespec);


See Also

  FindServiceSoap Class   |   FindResults Class   |   FindNearRouteSpecification Class   |   EntityType.Definition Property   |   CommonServiceSoap.GetEntityTypes Method