tags:

views:

749

answers:

3

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.

+1  A: 

Your zoom level looks too high.
The zoom should be between 1 and 17.

SLaks
Unfortunately this didn't help :(. I still get bright screen with no map at all.
Mariusz
Did you put in an API key?
SLaks
No, I didn't. Could you please tell me what it is and how to do it?
Mariusz
OK, I managed to solve the problem. I downloaded the source of a demo application provided by the author of that control and copied all necessary code that initializes the map from there. The thing was that I used ServerAndCache access mode and when I changed it to Server access mode, the control displayed map correctly. I'm not sure why. I might have not set some important properties of the control, I don't know which, however. Thanks for your suggestions anyway.
Mariusz
+1  A: 

please ask such questions in project forum: http://greatmaps.codeplex.com/Thread/List.aspx ;}

radioman
A: 

try setting the instance mode to server only

GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly

PJM