使用Windows Forms应用程序的地图

8
我正在开发一个C#/Winforms应用程序,需要使用地图(类似于Google地图、Bing地图等)。但我对ToU(许可证)-非商业使用等感到非常困惑。
我的问题:
1. 您会建议使用哪个地图提供者(最好是免费的),以便在Winforms应用程序中嵌入,用于商业用途?
2. 如果应用程序“离线”,即无法从地图服务器获取瓦片,您会推荐哪个地图提供者?
3. Google Earth 似乎很有前途,直到我读到了只有非商业使用的ToU条款,您是否知道是否可以通过购买许可证来豁免?是否有商业替代品?
3个回答

7
  1. 对于Windows应用程序,可以尝试查找OpenStreetMap以便在使用浏览器控件时进行Windows表单集成。

  2. 对于离线解决方案,您需要地图数据。最常用的地图数据格式之一是Shapefiles,这是ESRI的标准格式,您可以下载OpenStreetMap数据并将其转换为Shapefiles,然后导入到您的应用程序中。有一些开源项目使用Shapefiles进行地图渲染和其他GIS功能,例如SharpMap和DotSpatial(两者都是.Net实现)。

  3. 您可以搜索Google Earth Pro,也可以尝试来自NASA的World Wind(免费)。


我也写了一篇关于此的博客文章:https://habiboncoding.wordpress.com/2015/04/24/offline-mapping-in-windows-applications-using-c/ - Habib

0

0

使用Web浏览器控件尝试此代码,以获取两个位置之间的方向

   System.Text.StringBuilder queryaddress = new System.Text.StringBuilder();
string sStreet = string.Empty;
string sCity = string.Empty;
string sState = string.Empty;
string sPincode = string.Empty;
string sProvider_no = string.Empty;
queryaddress.Append("https://www.google.com/maps/dir/");

if (!string.IsNullOrEmpty(txtprovider_no.Text)) {
    sProvider_no = txtprovider_no.Text.Replace(" ", "+");
    queryaddress.Append(sProvider_no + "," + "+");
}
if (!string.IsNullOrEmpty(txtState.Text)) {
    sState = txtState.Text.Replace("  ", "+");
    queryaddress.Append(sState + "," + "+");
}
if (!string.IsNullOrEmpty(txtCity.Text)) {
    sCity = txtCity.Text.Replace("  ", "+");
    queryaddress.Append(sCity + "," + "+");
}
if (!string.IsNullOrEmpty(txtPincode.Text)) {
    sPincode = txtPincode.Text.Replace("  ", "+");
    queryaddress.Append(sPincode);
}

queryaddress.Append("/");
sStreet = string.Empty;
sCity = string.Empty;
sState = string.Empty;
sPincode = string.Empty;
if (!string.IsNullOrEmpty(txtlindmark.Text)) {
    sStreet = txtlindmark.Text.Replace("  ", "+");
    queryaddress.Append(sStreet + "," + "+");
}
if (!string.IsNullOrEmpty(txtclient_city.Text)) {
    sCity = txtclient_city.Text.Replace("  ", "+");
    queryaddress.Append(sCity + "," + "+");
}
if (!string.IsNullOrEmpty(ttxtclient_city.Text)) {
    sPincode = ttxtclient_city.Text.Replace("  ", "+");
    queryaddress.Append(sPincode);
}
if (!string.IsNullOrEmpty(txtclient_state.Text)) {
    sState = txtclient_state.Text.Replace("  ", "+");
    queryaddress.Append(sState + "," + "+");
}


WBR.Navigate(queryaddress.ToString());

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接