gpt4 book ai didi

c# - GMAP 和 OSM 仅在 C# 代码中显示 map 的一小部分

转载 作者:行者123 更新时间:2023-11-30 18:23:00 25 4
gpt4 key购买 nike

我想通过 Open Street Map 显示 map 。

我在 VS2013 中有一个 C# 代码来显示 GMAP 和 OSM 的 map 。

map 只能显示 map 的一小部分。我想我可以看到指定纬度/经度的区域 map 。

为什么?

谢谢

using System.Windows.Forms;
using GMap.NET.WindowsForms;
using GMap.NET;
using GMap.NET.MapProviders;
using GMap.NET.WindowsForms.Markers;

namespace drawMapByGmap
{
public partial class Form1 : Form
{
GMapOverlay overlayOne;
String contry;
public Form1()
{
InitializeComponent();
this.Load += new EventHandler(this.Form1_Load);

}

private void Form1_Load(object sender, EventArgs e)
{
mapexplr_Load(sender, e);
}

private void mapexplr_Load(object sender, EventArgs e)
{

//initialisation de notre map
gMapControl1.SetPositionByKeywords("Tunisia");
gMapControl1.MapProvider = GMapProviders.OpenStreetMap;
gMapControl1.MinZoom = 3;
gMapControl1.MaxZoom = 17;
gMapControl1.Zoom = 5;
gMapControl1.Manager.Mode = AccessMode.ServerAndCache;
//ajout des overlay
overlayOne = new GMapOverlay("OverlayOne");
//ajout de Markers
overlayOne.Markers.Add(new GMap.NET.WindowsForms.Markers.GMarkerGoogle(new PointLatLng(36.657403, 10.327148), GMarkerGoogleType.blue));
////ajout de overlay à la map
gMapControl1.Overlays.Add(overlayOne);
}

}
}

最佳答案

我试过你的代码,没有问题,所以你可以尝试将管理器模式设置为服务器

GMapControl1.Manager.Mode = AccessMode.ServerOnly

并确保你已连接到互联网,这是我测试用的图片

enter image description here

关于c# - GMAP 和 OSM 仅在 C# 代码中显示 map 的一小部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32941445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com