Using GMap.NET on C# Form: setup

Topics: General
Aug 11, 2011 at 11:22 AM
Edited Aug 11, 2011 at 11:23 AM

Hi there

First of all, I'd like to congratulate you for the very impressive job that you've done (it's really amazing) and also I'd like to thank you for choosing the open source philosophy: reading your source code is very instructive and let people learn how to create such amazing software.

So I'm trying to 'play' a little with that control of yours in a C# WinForm application.  As I haven't found any documentation (except of http://greatmaps.codeplex.com/documentation) I've followed the little instructions on http://www.codeproject.com/KB/miscctrl/GMapNET.aspx :

I've downloaded the aae170acdd8d version of source code, and there I got on the "\GMap.NET.WindowsForms\bin\Debug" directory the 1.5.5.5 version of "GMap.NET.Core.dll" and "GMap.NET.WindowsForms.dll"

* I have created my VS 2010 4.0 .NET Framework C# win form application
* I have added the two dll files to project reference.
* I have added GMapControl and MessagingServiceV2 to the tool

Then, i add a GMapControl to the winform and for the first try i copy the code showed on MainForm.cs

// config map 
            MainMap.MapProvider = GMapProviders.OpenStreetMap;
            MainMap.Position = new PointLatLng(54.6961334816182, 25.2985095977783);
            MainMap.MinZoom = 1;
            MainMap.MaxZoom = 17;
            MainMap.Zoom = 9;

The problem is that is does not recognise the GMapProviders class.
Does it mean that i have to add other dll libraries to make the project build successfully??
Or it means that i have to copy the GMapProviders.cs file to my project (and all the class files for each map provider in
the \GMap.NET.Core\GMap.NET.MapProviders directory)??

I don't know how people is using the code you have deliver: whether they change the source code of the whole application you
have created or whether they start from scratch, importing the dll and the controls that you have created.
So, if this is the case, could you please give a little list of the necessary dlls that are needed to show a map on a simple
winform application (so i can make work my application, making me not feel so dumb as i'm feeling now, and continue playing
with the possibilities that your application gives).

Thank you very much for your time, your work and your patience. And congratulations once again for your fantastic work!

Natxo
Aug 11, 2011 at 11:41 AM
Edited Aug 11, 2011 at 3:09 PM

just add:

 using GMap.NET.MapProviders;

p.s. when there is missing namespaces, just right click on the unrecognizable word and select Resolve

cheers ;}

Aug 11, 2011 at 2:43 PM

hehe... thanks a lot (though i'm feeling quite stupid at this moment ;) )