C# GMap.NET 不显示地图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1996101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GMap.NET shows no map
提问by Mariusz Schimke
I'm trying to use the GMap.NET.WindowsFormscontrol in my Windows forms application but I cannot make it show me any map.
我正在尝试在我的 Windows 窗体应用程序中使用GMap.NET.WindowsForms控件,但我无法让它显示任何地图。
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.
我通过单击工具箱上下文菜单中的“选择项目...”并浏览包含在下载的 zip 存档中的 GMap.NET.WindowsForms.dll,将控件添加到我的 Visual Studio 2010 工具箱。我还在我的解决方案中添加了对 GMap.NET.Core.dll 和 System.Data.SQLite.dll 的引用。
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).
然后我将出现在工具箱中的 GMapControl 放在我的应用程序的主窗体上,并将地图类型设置为 GoogleMap。但是,当我运行我的应用程序时,控件显示蓝屏和一段文字,上面写着“我们很抱歉,但我们没有此区域的此缩放级别的图像”,或者显示完全没有数据的亮屏(当我更改缩放级别时)。
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.
请帮忙。我不知道该怎么做,并且在 Internet 上找不到任何可以帮助我解决问题的信息。
Thank you very much in advance.
非常感谢您提前。
采纳答案by PJM
try setting the instance mode to server only
尝试将实例模式设置为仅服务器
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly
回答by SLaks
Your zoom level looks too high.
The zoom should be between 1 and 17.
您的缩放级别看起来太高了。
缩放比例应该在 1 到 17 之间。
回答by Sudhakar Tillapudi
You could use following statements before using gmap Control.
在使用 gmap Control 之前,您可以使用以下语句。
GMapProvider.WebProxy = WebRequest.GetSystemWebProxy();
GMapProvider.WebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;
回答by Pablo Simon DiEstefano
In version 1.7.0 of GMap.NET the satellite view is not working, you should download the lastest version from here:
在 GMap.NET 的 1.7.0 版中,卫星视图不起作用,您应该从这里下载最新版本:
https://www.nuget.org/packages/GMap.NET.Presentation/
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.
如果您可以在您的环境中看到卫星视图,那是因为您在缓存中有地图,但您将看不到某些地方。使用新版本,您将从服务器下载地图,您会看到它。