Using GMap.NET in .NET4

Topics: General
Jun 13, 2011 at 7:23 AM

Hi,

I am a beginner at C# and WPF and would like to use GMap.NET in my own application. I have done the following steps:

1) New C# project, WPF, VS2010, x86.

2) Added reference to GMap.NET.Core.dll, GMap.NET.WindowsPresentation.dll, System.Data.SQLite.dll (x86)

3) Added the control to my toolbox, so i see "GMapControl", "GMapControlNew", and "TilePrefetcher" in my toolbox.

4) Added a new GMapControl object to my window, in a grid.

 

When I build my application to test, it shows that the GMapControl object loaded, but no imagery. Instead, there are many "Exception: The type initializer for 'SingletonCreator' threw an exception." messages all over the tiled areas. In the background, there are "We are sorry, but we don't have imagery at this zoom level for this region". Setting GMapControl.Zoom to any value between 2 and 17 doesn't seem to help. Will appreciate any advice to point me in the right direction please! Still learning to code so bear with me!

Thank you!

Coordinator
Jun 13, 2011 at 7:31 AM

use AnyCPU target

Jun 13, 2011 at 7:36 AM

Target changed to "Any CPU", result is still the same. I am sorry I think I must be doing something really wrong here! :/

Jun 13, 2011 at 7:43 AM

I have tried adding a configuration file for .NET4 by doing:

1) right-click on project > Add > New Item > Visual C# Application Configuration File

2) changing the configuration file as per http://greatmaps.codeplex.com/documentation

no difference :(

Coordinator
Jun 13, 2011 at 7:45 AM

zip your test project, i'll check the issue

Jun 13, 2011 at 8:00 AM

Thanks! Zipping and send it via email!

Coordinator
Jun 13, 2011 at 8:51 AM

just add this ;}

Jun 13, 2011 at 8:54 AM

OH WOW. Must have added the wrong config file. The first time i changed the config file to some other name. So now it works! Great thanks for your help! :)

Coordinator
Jun 13, 2011 at 8:55 AM

cheers ;}

Coordinator
Jul 11, 2011 at 11:39 AM

p.s. new version doesn't require app config file anymore

Jul 11, 2011 at 11:52 AM
Cool will download and try tomorrow. Thank you so much for the heads up! :)

Sent from my iPhone

On Jul 11, 2011, at 19:39, "radioman"<notifications@codeplex.com> wrote:

From: radioman

p.s. new version doesn't require app config file anymore

Feb 1, 2012 at 6:58 AM

Dears, I have the same problem but no result .. when I add the control to the form.. after running the map takes time to display blue quarters containing 

 

"Exception: the operation has timed out we are sorry but we dont have imagery at this zoom level for this region"

 

please i need your support .. as I wast lots of time trying to find solution

Coordinator
Feb 1, 2012 at 7:02 AM
Edited Feb 1, 2012 at 7:02 AM

your provider? too high zoom, old version?

Feb 1, 2012 at 7:07 AM

unfortunately.. i'm using the latest version of the GMap.NET.WindowsForms which is v2.0.50727

and this is my code

   public Form1()
        {
            InitializeComponent();

            SuspendLayout();
            GMapControl MainMap = new GMapControl();
            {
                MainMap.MapProvider = GMapProviders.YahooMap;
                MainMap.Position = new PointLatLng(54.6961334816182, 25.2985095977783);
                MainMap.MinZoom = 1;
                MainMap.MaxZoom = 17;
                MainMap.Zoom = 9;
                MainMap.Dock = DockStyle.Fill;
            }
            Controls.Add(MainMap);
            ResumeLayout(true);
        }
nothing more .. :(

Coordinator
Feb 1, 2012 at 7:13 AM

did you added both references: GMap.NET.Core.dll && GMap.NET.WindowsForms.dll ?

Feb 1, 2012 at 7:16 AM

yes., GMap.NET.WindowsForms v2.0.50727, GMap.NET.Core v2.0.50727 and  BSE.Windows.Forms v2.0.50727

 


Coordinator
Feb 1, 2012 at 7:21 AM

you use old version, there is no BSE.Windows.Forms anymore

Feb 1, 2012 at 7:27 AM

could you please send me link of the last version ... 

I have download it from http://greatmaps.codeplex.com/releases/view/20235#DownloadId=67818

or what i have to do .. i have deleted the reference of  BSE.Windows.Forms .. but still the same result

Coordinator
Feb 1, 2012 at 7:31 AM

http://greatmaps.codeplex.com/releases/view/73162#DownloadId=336069

Feb 1, 2012 at 7:41 AM

OMG .. I have realized that the system configuration add proxy to enter the internet .. I have to work around this problem 

Coordinator
Feb 1, 2012 at 7:54 AM

GMapProvider.WebProxy = new WebProxy("10.2.0.100", 8080);
GMapProvider.WebProxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeada");

Feb 1, 2012 at 9:50 AM

it works , but the rendering of the map is extremely slow :( while the connection speed is so fast

Coordinator
Feb 1, 2012 at 10:43 AM

rendering is as fast as you can get on your machine

Feb 1, 2012 at 11:24 AM

there is more than strange things , 

when I use MainMap.MapProvider = GMapProviders.GoogleMap; it does not work , 

while MainMap.MapProvider = GMapProviders.YahooMap; works

 

Coordinator
Feb 1, 2012 at 11:31 AM

it works here ;}

Feb 1, 2012 at 11:50 AM

i'm so sorry if I ask lot of questions really thank you for your support but i'd like to know something , 

how can i tied 

GMapProvider.WebProxy = new WebProxy("10.2.0.100", 8080);
GMapProvider.WebProxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeada");

with 

the gmap control

Coordinator
Feb 1, 2012 at 12:05 PM

?

Feb 1, 2012 at 12:12 PM

as i see there was something like 

// set your proxy here if need           

MainMap.Instance.Proxy = new WebProxy("10.2.0.100", 8080);           

MainMap.Instance.Proxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeadam");

OR

MainMap.Manager.Proxy = new WebProxy("10.2.0.100", 8080); 

MainMap.Manager.Proxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeadam");

 

to tied the proxy with the MainMap which is the gmap control

 

but in this version of GMap.NET.Core.dll && GMap.NET.WindowsForms.dll there is no MainMap.Manager.Proxy or MainMap.Instance.Proxy 

Feb 1, 2012 at 12:40 PM

 

Error 1 'GMap.NET.GMaps' does not contain a definition for 'Proxy' and no extension method 'Proxy' accepting a first argument of type 'GMap.NET.GMaps' could be found (are you missing a using directive or an assembly reference?) D:\GoogleMapPlanningTool\GoogleMapPlanningTool\Form1.cs 42 33 GoogleMapPlanningTool

Coordinator
Feb 1, 2012 at 12:42 PM

sorry, GMapProvider.WebProxy

Feb 1, 2012 at 12:50 PM

ok great i used 

GMapProvider.WebProxy = new WebProxy("10.2.0.100", 8080);
GMapProvider.WebProxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeada");

but what is relation between GMapProvider and MainMap , there is nothing to connect the MainMap  control with GMapProvider

Feb 1, 2012 at 12:52 PM

 public Form1()
        {
            GMapProvider.WebProxy = new WebProxy("10.2.0.100", 8080);
            GMapProvider.WebProxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeada");
            
            InitializeComponent();

            SuspendLayout();
            MainMap = new GMapControl();
            {
                 MainMap.MapProvider = GMapProviders.GoogleMap;
                MainMap.Position = new PointLatLng(27.6961334816182, 30.2985095977783);
                MainMap.MinZoom = 1;
                MainMap.MaxZoom = 17;
                MainMap.Zoom = 7;
                MainMap.CanDragMap = true;
                MainMap.Dock = DockStyle.Fill;
            }
            Controls.Add(MainMap);
            ResumeLayout(true);
        }
GMapProvider is not assiend to MainMap .. that's what i mean 

Coordinator
Feb 1, 2012 at 1:06 PM

you've set faked address and credentials, it will not work

Feb 1, 2012 at 1:09 PM

you mean faked address >> 10.2.0.100

faked credentials>> "ogrenci@bilgeadam.com", "bilgeada"

???

Coordinator
Feb 1, 2012 at 1:13 PM

Ofcourse ;}

Feb 1, 2012 at 1:16 PM

i'm so sorry but from where can i get the right ones?

Coordinator
Feb 1, 2012 at 1:21 PM

"OMG .. I have realized that the system configuration add proxy to enter the internet .. I have to work around this problem " its your proxy, how do i know ;}

Feb 1, 2012 at 1:36 PM

Thank You sooooooooooooooooooo much :) 

really you are Great Person ... Thank you for your amazing support :)

Coordinator
Feb 1, 2012 at 1:41 PM

;} anytime, anywhere

Feb 1, 2012 at 1:57 PM

Thank you :)

the last question , it there a way to add 1000s marker or icons in the map without killing the performance ?

Coordinator
Feb 1, 2012 at 2:03 PM

check the flight demo, it handles > 1000 markers quite good

Feb 2, 2012 at 9:12 AM

mmm .. really i dont understand what  flight demo is? and how it works :(

Coordinator
Feb 2, 2012 at 10:41 AM

not my problem ;}

Feb 2, 2012 at 10:48 AM

ok

Feb 27, 2012 at 2:16 PM

hi, i'm currently working desktop app using gmapcontrol and i can't drag it. Can you help me to solve this problem pls? 

Coordinator
Feb 27, 2012 at 2:18 PM

default drag button is right

Feb 27, 2012 at 2:51 PM
Edited Feb 28, 2012 at 2:41 AM

oh, thanks. it works :)

 

Mar 15, 2012 at 1:53 AM

Hi,

I am looking to do a particular thing and I wanted an expert's advice in knowing if Gmap.Net is the right thing to use. 

What I need to do is this - 

Have the user select certain filtering criteria from dropdown (this runs queries on the database and generates XML resultsets). Then depending on what criteria the user has selected, render that particular XML onto the map. Then if the user hovers over a particular state, the data for that particular state (in that resultset) will be displayed in a balloon. 

Please help me. Its an urgent requirement. 

Thanks!

Coordinator
Mar 15, 2012 at 11:29 AM

i wonder what it has to do with 'Using GMap.NET in .NET4' ;} i guess nothing at all

Mar 15, 2012 at 2:33 PM

I wanted to knw if that can be done using GMap.net in a windows forms application. Can Gmap be connected to the database to render xml resultset?

Coordinator
Mar 15, 2012 at 2:41 PM

you can render whatever you want

Mar 15, 2012 at 2:51 PM

Are there any examples that do such rendering?

Coordinator
Mar 15, 2012 at 2:58 PM

there are general demos, customize for yourself as you want

Mar 15, 2012 at 3:19 PM

There is hardly any documentation available.

Anyway, thanks for your help!

Coordinator
Mar 15, 2012 at 6:11 PM

nobody pay for documentation ;}