Microsoft KB Archive/883990

= Search radius has increased in MapPoint Web Service 3.5 =

Article ID: 883990

Article Last Modified on 3/23/2007

-

APPLIES TO


 * Microsoft MapPoint Web Service 3.5

-



INTRODUCTION
The radius of the search area for points of interest in Microsoft MapPoint Web Service applications has been increased from 160 kilometers (100 miles) to 400 kilometers (248 miles).

This search radius increase affects the parameter that is passed to the FindNearby method of the FindServiceSoap class. Because of this change, the Distance property of the object of the FindNearbySpecification class that defines the search radius must be more than zero (0) and not more than 400 kilometers (248 miles).

The maximum number of find results that are returned by the FindNearby method remains unchanged at 500. By default, the results that are obtained by using the FindNearby method are sorted by distance in ascending order.



MORE INFORMATION
Increasing the search radius increases the response time significantly because of the extensive searching that must be performed and because of the possible large number of results that may be returned by the MapPoint Web Service. If you want to find the points of interest in a large geographic area based on a specific property or a specific set of properties, use the FindByProperty method instead of the FindNearby method of the FindServiceSoap class. For example, if you want to find the Fourth Coffee store in the state of Washington, use the FindByProperty method. You will search for store entities whose State property is set to Washington.

However, if you want to find the points of interest purely based on their distance from a specific latitude and longitude, use the FindNearby method and specify the search radius that you want. For example, if your goal is to find all Fabrikam car dealerships that are located within 150 miles of the Space Needle in Seattle, Washington, use the FindNearby method.

The following code example shows how to use the new search radius limit with the FindNearby method to find points of interest within a 125 mile (201 kilometer) radius of a specified latitude and longitude.

This example assumes that the service instance findService has already been created and that the MapPoint Web Service namespace has been imported.

Microsoft Visual Basic .NET code
'Output a property value for each 'MapPoint.FourthCoffeeSample store that is nearby. Dim findNearbySpec As New FindNearbySpecification findNearbySpec.DataSourceName = &quot;MapPoint.FourthCoffeeSample&quot; findNearbySpec.Distance = 125 findNearbySpec.LatLong = New LatLong findNearbySpec.LatLong.Latitude = 47.6 findNearbySpec.LatLong.Longitude = -122.33 findNearbySpec.Filter = New FindFilter findNearbySpec.Filter.EntityTypeName = &quot;FourthCoffeeShops&quot;

Dim foundResults As FindResults foundResults = findService.FindNearby(findNearbySpec)

Console.WriteLine(&quot;Fourth Coffee Shop Store List&quot;) Dim fr As FindResult For Each fr In foundResults.Results Console.WriteLine(fr.FoundLocation.Entity.Name + &quot;: &quot; + fr.FoundLocation.Entity.Properties(6).Value.ToString) Next

Microsoft Visual C# .NET code
//Output a property value for each //MapPoint.FourthCoffeeSample store that is nearby. FindNearbySpecification findNearbySpec = new FindNearbySpecification; findNearbySpec.DataSourceName = &quot;MapPoint.FourthCoffeeSample&quot;; findNearbySpec.Distance = 125; findNearbySpec.LatLong = new LatLong; findNearbySpec.LatLong.Latitude = 47.6; findNearbySpec.LatLong.Longitude = -122.33; findNearbySpec.Filter = new FindFilter; findNearbySpec.Filter.EntityTypeName = &quot;FourthCoffeeShops&quot;;

FindResults foundResults; foundResults = findService.FindNearby(findNearbySpec);

Console.WriteLine(&quot;Fourth Coffee Shop Store List&quot;); foreach(FindResult fr in foundResults.Results) {   Console.WriteLine(fr.FoundLocation.Entity.Name + &quot;: &quot;   + fr.FoundLocation.Entity.Properties[6].Value.ToString); }

