GMap.NET不显示地图
我正在尝试使用 GMap.NET.WindowsForms 控件我的 Windows 窗体应用程序,但我无法让它向我显示任何地图。
我所做的如下:
我通过从工具箱的上下文菜单中单击“选择项目...”并浏览下载的 zip 存档中包含的 GMap.NET.WindowsForms.dll,将该控件添加到我的 Visual Studio 2010 工具箱中。我还在我的解决方案中添加了对 GMap.NET.Core.dll 和 System.Data.SQLite.dll 的引用。
然后我将工具箱中出现的 GMapControl 放在我的应用程序的主窗体上,并将地图类型设置为 GoogleMap。然而,当我运行我的应用程序时,控件显示蓝屏,并显示一段文字“我们很抱歉,但我们在该区域没有此缩放级别的图像”,或者显示完全没有数据的明亮屏幕(当我更改缩放级别时)。
这是我的代码:
GMapMain.MapType = MapType.GoogleMap;
GMapMain.MaxZoom = 100;
GMapMain.MinZoom = 0;
GMapMain.Zoom = 50;
GMapMain.CurrentPosition = new PointLatLng(54.6961334816182, 25.2985095977783);
GMapMain.ReloadMap();
请帮忙。我不知道该怎么办,也无法在互联网上找到任何可以帮助我解决问题的信息。
预先非常感谢您。
I'm trying to use the GMap.NET.WindowsForms control in my Windows forms application but I cannot make it show me any map.
Here is what I did:
I added the control to my Visual Studio's 2010 toolbox by clicking 'Choose Items...' from the toolbox's context menu and browsing for the GMap.NET.WindowsForms.dll included in the downloaded zip archive. I also added references to GMap.NET.Core.dll and System.Data.SQLite.dll in my solution.
Then I put the GMapControl that appeared in the toolbox on the main form of my application and set the map type to GoogleMap. When I run my application, however, the control shows either a blue screen with a piece of text saying "We are sorry, but we don't have imagery at this zoom level for this region" or a bright screen with completely no data (when I change zoom level).
Here is my code:
GMapMain.MapType = MapType.GoogleMap;
GMapMain.MaxZoom = 100;
GMapMain.MinZoom = 0;
GMapMain.Zoom = 50;
GMapMain.CurrentPosition = new PointLatLng(54.6961334816182, 25.2985095977783);
GMapMain.ReloadMap();
Please help. I have no idea what to do and I cannot find any information in the Internet that could help me solve the problem.
Thank you very much in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在使用 gmap Control 之前,您可以使用以下语句。
You could use following statements before using gmap Control.
尝试将实例模式设置为仅服务器
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly
try setting the instance mode to server only
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly
您的缩放级别看起来太高了。
变焦应在 1 到 17 之间。
Your zoom level looks too high.
The zoom should be between 1 and 17.
在 GMap.NET 1.7.0 版本中,卫星视图无法正常工作,您应该从此处下载最新版本:
https://www.nuget.org/packages/GMap.NET.Presentation/
您可以使用卫星视图。
如果您可以在您的环境中看到卫星视图,那是因为您的缓存中有地图,但您将看不到某些地方。在新版本中,您将从服务器下载地图,并且可以清楚地看到它。
In version 1.7.0 of GMap.NET the satellite view is not working, you should download the lastest version from here:
https://www.nuget.org/packages/GMap.NET.Presentation/
with that you can use the satellite view.
If you can see the satellite view in your environmet it's because you have the map in the cache but you will can not see some places. With the new version, you will download the map from the server and you will see it well.