Get list of Local Businesses using Bing Maps Search service API
I am developing a Windows Phone 7 Silverlight application that currently displays a map that show's the user where they are by getting the coordinates from location services. I can g开发者_运维技巧et an address using bing Reverse geocoding API.
I would like to display local businesses to the user that may be off interest by placing pushpins on the map. However I'm not able to get any search results from the Search Service API. Whatever I enter I get 0 results and I find the documentation lacking. I've tried following this example but very little description is given of the filter parameters for example.
What I currently have:
StructuredSearchQuery query = new StructuredSearchQuery();
query.Keyword = "Petrol Station";
query.Location = "New Road, Belper DE56 1";
searchRequest.SearchOptions = new SearchOptions();
searchRequest.SearchOptions.Filters =
new FilterExpression()
{
PropertyId = 1,
CompareOperator = CompareOperator.Equals,
FilterValue = 11199
};
SearchServiceClient searchServiceClient = new SearchServiceClient();
searchServiceClient.SearchCompleted += new EventHandler<SearchCompletedEventArgs>(searchServiceClient_SearchCompleted);
searchServiceClient.SearchAsync(searchRequest);
void searchServiceClient_SearchCompleted(object sender, SearchCompletedEventArgs e)
{
SearchResponse searchResponse = e.Result;
}
I would prefer to use the exact location in the search using the coordinates I've obtained but can't see how. As far as I can tell my search should be returning all businesses in the category of 11199 (Bars and Taverns) but whatever location I enter I get 0 results.
Any Ideas?
I've ended up using results from Google local search which produces fantastic results and which you can supply an exact Geo-location to specify the area to search.
In case it's useful to someone else later I used Google API for .net to call the google service and then display the points on the silverlight Bing maps control.
I do know that the local business search on Bing Maps for Wp7 is limited to US. In fact I'm living in Canada and the results are useless except if you change your local settings for "browser amd search language" in the Regional screen of the Settings tile like described here:
"Bing Maps has issues finding local results"
http://social.answers.microsoft.com/Forums/en-US/windowsphone7/thread/d1f0ce7f-464f-4804-9c61-48cec47fe518/
maybe the WS API has some same limitations ?
You have several options to localize the results of the Bing Search SOAP API, namely:
- Set the
RequestBase.Culture
property toen-GB
- Set the SearchRegion class properties of
BoundingArea
orGeocodeLocation
from a previousGeocodeResult
If you are using the Phonebook SourceType from the Bing API v2, you could try setting the SearchRequest.Market
property to the appropriate culture code.
精彩评论