简体   繁体   English

在WP7 Bing Maps上搜索字符串

[英]Search for string on WP7 Bing Maps

Is it possible to make a query to the Bing Maps with a string (Being a location) ? 是否可以使用字符串(作为位置)查询Bing地图?

I have a user entered field, then I want the user to be able to press a button and then a certain string is put into Bing maps (Maybe tombstone my app meanwhile?) Something like 我有一个用户输入字段,然后我希望用户能够按下一个按钮,然后将某个字符串放入Bing地图(也许tombstone我的应用程序同时?)

string UserLocation = "Wall Street New York";
BingMapsApi.Search(UserLocation);

You can query Bing maps via the Bing Maps Rest API , it sounds like you want to find a location via a search string . 您可以通过Bing Maps Rest API查询Bing地图,听起来您想通过搜索字符串查找位置 For example, this query find the Microsoft offices; 例如,此查询查找Microsoft办事处;

http://dev.virtualearth.net/REST/v1/Locations/1%20Microsoft%20Way%20Redmond%20WA%2098052?o=xml&key=BingMapsKey http://dev.virtualearth.net/REST/v1/Locations/1%20Microsoft%20Way%20Redmond%20WA%2098052?o=xml&key=BingMapsKey

Use the maps: parameter, and use a WebBrowserTask to navigate to the result, as if it were a URL. 使用maps:参数,并使用WebBrowserTask导航到结果,就像它是一个URL。

string location = "maps:" + SelectedLocation.Street + " " + SelectedLocation.PostalCode;
location = HttpUtility.UrlEncode(location);
WebBrowserTask task = new WebBrowserTask();
task.URL = location;
task.Show();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM