简体   繁体   English

从utr执行Google / Bing地图搜索

[英]Perform a Google/Bing Maps search from a utr

I'm working on project that simulates (for lack of better word) a GPS. 我正在研究模拟(缺乏更好的词)GPS的项目。 The user is able to select a State, City and address eg 000 someadress.dr and I have it set up so that when the submit button is clicked all of these components are combined into a single string. 用户可以选择一个州,城市和地址,例如000 someadress.dr,我设置它,以便在单击提交按钮时,所有这些组件都合并为一个字符串。 I'm wondering if its possible to perform a map search on either platform through the address bar, if it is could possibly do something like this: 我想知道是否有可能通过地址栏在任一平台上执行地图搜索,如果它可能会这样做:

private void btnSubmitAddress_Click(object sender, EventArgs e) {

    string stateSelected = this.cbState.Text; // Stores the selected State
    string citySelected = this.cbCity.Text; // Stores the selected City
    string addressSelected = this.cbPreDefAddress.Text; // Store the selected address

    string result = addressSelected + " " + citySelected + " " + stateSelected; // Creates a single address string.

    wbSatNavBrowser.Navigate("https://www.bing.com/maps/search?" + result);
}

The Bing Maps website is a consumer product and shouldn't be loaded inside of business applications. Bing Maps网站是消费者产品,不应在业务应用程序内部加载。 Instead, consider using the Bing Maps developer API's. 相反,请考虑使用Bing Maps开发人员API。 The Bing Maps WPF control works inside of WinForms, here is a blog post on this: https://rbrundritt.wordpress.com/2012/01/05/using-bing-maps-in-winforms/ Bing Maps WPF控件在WinForms内部运行,这是一篇博客文章: https//rbrundritt.wordpress.com/2012/01/05/using-bing-maps-in-winforms/

You can geocode locations using the REST services. 您可以使用REST服务对位置进行地理编码。 Here is a great .NET library for using these services: https://github.com/Microsoft/BingMapsRESTToolkit 这是一个很棒的.NET库,可以使用这些服务: https//github.com/Microsoft/BingMapsRESTToolkit

If you want the most mapping features, you can also host the Bing Maps web control inside of a web browser control. 如果您需要最多的映射功能,还可以在Web浏览器控件中托管Bing Maps Web控件。 Here is a code sample: https://code.msdn.microsoft.com/Using-the-Bing-Maps-V8-Web-07e21f3a?redir=0 这是一个代码示例: https//code.msdn.microsoft.com/Using-the-Bing-Maps-V8-Web-07e21f3a?redir = 0

The docs show some examples of how to pass parameters. 文档展示了如何传递参数的一些示例。

This example sets the centerpoint of the map. 此示例设置地图的中心点。

http://bing.com/maps/default.aspx?cp=47.677797~-122.122013 http://bing.com/maps/default.aspx?cp=47.677797~-122.122013

To open Bing Maps to a specific address: 要将Bing地图打开到特定地址:

http://bing.com/maps/default.aspx?rtp=adr.One%20Microsoft%20Way,%20Redmond,%20WA%2098052~pos.45.23423_-122.1232_MyPlace&rtop=0~1~0 http://bing.com/maps/default.aspx?rtp=adr.One%20Microsoft%20Way,%20Redmond,%20WA%2098052~pos.45.23423_-122.1232_MyPlace&rtop=0~1~0

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

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