Click here to Skip to main content
Click here to Skip to main content

GMap.NET - Great Maps for Windows Forms and Presentation

, 16 Apr 2013 MIT
Rate this:
Please Sign up or sign in to vote.
GMap.NET is a powerful, free, cross platform, Open Source .NET control. It enables the use of routing, geocoding, and maps from Google, Yahoo!, OpenStreet in Windows Forms and Presentation, and supports caching!



Google Maps are cool, yeah? But it's useful only in the browser, and is insufficient for real time tracking. It also does not have cache so Google servers are overloaded. This control removes all these deficiencies! It also gives the .NET developer unlimited ability to extend it!

GMap.NET is great and Powerful, Free, cross platform, open source .NET control. Enable use routing, geocoding, directions and maps from Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yandex,,,, NearMap, OviMap, CloudMade, WikiMapia, MapQuest in Windows Forms & Presentation, supports caching and runs on windows mobile! 


The basic idea is simple: get the required data from Google/etc., cache it, and use it. Fast, simple, and practical.

Using the Code

It's more than easy. GMap.NET.dll and GMap.NET.WindowsForms.dll contain the user control. Add it to your project and simply use it.

Here are the basic control initial options: 

public MainForm()


   System.Net.IPHostEntry e =
   MainMap.Manager.Mode = AccessMode.CacheOnly;
   MessageBox.Show("No internet connection avaible, going to CacheOnly mode.", 
         "GMap.NET - Demo.WindowsForms", MessageBoxButtons.OK,

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

// add your custom map db provider
//GMap.NET.CacheProviders.MySQLPureImageCache ch = new GMap.NET.CacheProviders.MySQLPureImageCache();
//ch.ConnectionString = @"server=sql2008;User Id=trolis;Persist Security Info=True;database=gmapnetcache;password=trolis;";
//MainMap.Manager.SecondaryCache = ch;

// set your proxy here if need
//GMapProvider.WebProxy = new WebProxy("", 8080);
//GMapProvider.WebProxy.Credentials = new NetworkCredential("", "bilgeada");

// map events
   MainMap.OnPositionChanged += new PositionChanged(MainMap_OnPositionChanged);

   MainMap.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart);
   MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);

   MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);
   MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);

   MainMap.OnMarkerClick += new MarkerClick(MainMap_OnMarkerClick);
   MainMap.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter);
   MainMap.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave);

   MainMap.OnPolygonEnter += new PolygonEnter(MainMap_OnPolygonEnter);
   MainMap.OnPolygonLeave += new PolygonLeave(MainMap_OnPolygonLeave);

   MainMap.OnRouteEnter += new RouteEnter(MainMap_OnRouteEnter);
   MainMap.OnRouteLeave += new RouteLeave(MainMap_OnRouteLeave);

   MainMap.Manager.OnTileCacheComplete += new TileCacheComplete(OnTileCacheComplete);
   MainMap.Manager.OnTileCacheStart += new TileCacheStart(OnTileCacheStart);
   MainMap.Manager.OnTileCacheProgress += new TileCacheProgress(OnTileCacheProgress);

As you can see, the control options are quite simple. And there is nothing more to add.

Points of Interest

Well, it was quite cryptic to figure out how Google manages tiles, what coordinate system it uses, the JSON decryption, etc.


Go to the project's CodePlex site to get a running update of any changes or improvements I've made.  


This article, along with any associated source code and files, is licensed under The MIT License


About the Author
Software Developer
Lithuania Lithuania
No Biography provided

Comments and Discussions

QuestionTilt Map PinmemberMember 42973466-Aug-14 17:27 
QuestionReally wished this worked. PinmemberDaniel Krusky27-Jul-14 8:22 
AnswerRe: Really wished this worked. Pinmemberradioman.lt29-Jul-14 2:31 
Questionmultiple Marker Cursor freeze to "Hand" PinmemberMember 1058111922-Feb-14 4:19 
AnswerRe: multiple Marker Cursor freeze to "Hand" Pinmemberradioman.lt22-Feb-14 8:52 
GeneralRe: multiple Marker Cursor freeze to "Hand" Pinmemberwilli-5824-Feb-14 16:47 
QuestionGood job! Pinmemberg0d20127-Jan-14 20:06 
GeneralMy vote of 5 PinmemberThatsAlok8-Nov-13 3:01 
GeneralMy vote of 1 Pinmemberdavemaster995-Jul-13 13:58 
GeneralRe: My vote of 1 Pinmemberradioman.lt7-Jul-13 11:12 
GeneralRe: My vote of 1 Pinmemberdavemaster997-Jul-13 16:38 
GeneralMy vote of 2 PinmemberGregoryW29-Apr-13 0:26 
QuestionCan't Browse at CP PinmemberAlan Burkhart22-Apr-13 14:33 
AnswerRe: Can't Browse at CP PinmemberSteveQ5622-Apr-13 22:33 
GeneralRe: Can't Browse at CP Pinmemberradioman.lt22-Apr-13 22:35 
GeneralRe: Can't Browse at CP PinmemberAlan Burkhart23-Apr-13 14:06 
GeneralMy vote of 5 PinmemberPrasad Khandekar16-Apr-13 10:15 
QuestionHow to cache maps? PinmemberS.Faizan.Ali15-Apr-13 20:34 
AnswerRe: How to cache maps? Pinmemberradioman.lt16-Apr-13 1:22 
QuestionMapControl does not contain the properties of MapType and CurrentPosition Pinmemberjhyap858-Apr-13 16:20 
AnswerRe: MapControl does not contain the properties of MapType and CurrentPosition Pinmemberradioman.lt8-Apr-13 21:17 
GeneralRe: MapControl does not contain the properties of MapType and CurrentPosition Pinmemberjhyap858-Apr-13 22:18 
The demo source is just .exe.. Is there any possible to review some example source code? Because I just need a static map, and on the map, I marked a "source" location coordinate, and "target" location coordinate.
I had successfully add the marker of location coordinate for my "source" and my "target". What I need now is, I want to create an arrow or a straight line (route line), to point to the "target" location from the "source" location. But how to do this using the lib?
And finally some mouser control like grab, better zoom in zoom out scaling..
GeneralRe: MapControl does not contain the properties of MapType and CurrentPosition Pinmemberradioman.lt8-Apr-13 23:23 
GeneralRe: MapControl does not contain the properties of MapType and CurrentPosition Pinmemberjhyap859-Apr-13 4:14 
GeneralRe: MapControl does not contain the properties of MapType and CurrentPosition Pinmemberjhyap859-Apr-13 16:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150224.1 | Last Updated 16 Apr 2013
Article Copyright 2009 by
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid