使用Bing Maps搜索服务API获取本地业务列表 [英] Get list of Local Businesses using Bing Maps Search service API

查看:141
本文介绍了使用Bing Maps搜索服务API获取本地业务列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Windows Phone 7 Silverlight应用程序,该应用程序当前通过从位置服务获取坐标来显示一张地图,向用户显示他们所在的位置.我可以使用bing反向地理编码API获取地址.

我想通过在地图上放置图钉来向可能不感兴趣的用户显示本地商家.但是,我无法从搜索服务API .无论我输入什么,都会得到0个结果,但我发现缺少文档.我已经尝试按照以下示例进行操作,但是对过滤器参数的描述很少例如.

我目前拥有的东西:

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;
        }

我希望使用已经获得的坐标在搜索中使用确切的位置,但看不到如何.据我所知,搜索应该返回11199类别中的所有企业(酒吧和酒馆),但是无论我输入的位置为何,我都会得到0条结果.

有什么想法吗?

解决方案

我最终使用了来自Google本地搜索的结果,该结果会产生出色的结果,并且您可以提供确切的地理位置来指定要搜索的区域./p>

如果以后对其他人有用,我使用了 .net的Google API 调用Google服务,然后在silverlight必应地图控件上显示这些点.

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 get 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.

这篇关于使用Bing Maps搜索服务API获取本地业务列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆