I am trying to display a dynamic google map on a windows form in .NET
I have succeeded in implementing a windows form asking a request on google map as followed :
public Form1()
{
InitializeComponent();
}
private void find_data_Click_1(object sender, EventArgs e)
{
string street = txt_street.Text;
string city = txt_city.Text;
try
{
StringBuilder queryaddress = new StringBuilder();
queryaddress.Append("http://maps.google.com/maps?q=");
if (street != string.Empty)
{
queryaddress.Append(street + "," + "+");
}
if (city != string.Empty)
{
queryaddress.Append(city + "," + "+");
}
webBrowser1.Navigate(queryaddress.ToString());
}
catch
{
MessageBox.Show("Error");
}
}
Then I succeeded in having a staticmap with google api with multiple markers doing this :
private void button2_Click(object sender, EventArgs e)
{
try
{
StringBuilder queryaddress = new StringBuilder();
queryaddress.Append("https://maps.googleapis.com/maps/api/staticmap?center=63.259591,-144.667969&zoom=6&size=400x400&markers=color:blue%7Clabel:S%7C62.107733,-145.541936&markers=size:tiny%7Ccolor:green%7CDelta+Junction,AK&markers=size:mid%7Ccolor:0xFFFF00%7Clabel:C%7CTok,AK&key=myApiKey");
webBrowser1.Navigate(queryaddress.ToString());
}
catch
{
MessageBox.Show("Error");
}
}
What I would like to have is the same output as the staticmap with multiple markers but with the interaction offers as in google map like in the first code portions.
I use to code with R and python, using the library leaflet to ease the implementation.
I don't know how to do multiple plot markers on interactive maps in C#.
我终于在此地址找到了包含教程的交钥匙解决方案: http : //www.independent-software.com/gmap-net-tutorial-maps-markers-and-polygons/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.