Search radius has increased in MapPoint Web Service 3.5 (883990)
The information in this article applies to:
- Microsoft MapPoint Web Service 3.5
INTRODUCTIONThe 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 INFORMATIONIncreasing 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 = "MapPoint.FourthCoffeeSample"
findNearbySpec.Distance = 125
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
Microsoft Visual C# .NET code
//Output a property value for each
//MapPoint.FourthCoffeeSample store that is nearby.
FindNearbySpecification findNearbySpec = new FindNearbySpecification();
findNearbySpec.DataSourceName = "MapPoint.FourthCoffeeSample";
findNearbySpec.Distance = 125;
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());
}
REFERENCESFor more information, visit the following Microsoft Developer Network (MSDN) Web sites:
Modification Type: | Major | Last Reviewed: | 8/16/2004 |
---|
Keywords: | kbWebServices kbhowto kbinfo KB883990 kbAudDeveloper |
---|
|