Geeks With Blogs
Saif Khan { I am Saif } "Knowledge is power, information is free, share it!"

 
Recently I was working on a project where I needed to implement mapping functionality - I am not new to mapping technology, as a matter fact, a few years back I created my own Winform mapping control which interfaced with yahoo and ArcGIS maps which works great in some of my apps, however, I was looking for something more and didn’t want to re-invent the wheel – so to speak. I stumbled upon GMap.NET and as one user put it, “Absolutely fantastic piece of work”. The only thing lacking is proper documentation.


Overview
GMap.NET is a FREE .NET control which enables mapping functionality to your application. It can be used in your Winform, WPF and Mobile application and supports several maps including

  • OpenStreetMap
  • Yahoo Maps
  • Bing Maps
  • ArcGIS
  • Google – sort of, support has been discontinued. Long story short, Google complained that the developer was in violation of their licenses blah blah.

Here are a few things you need to understand when using the the control

1. What is the map control (GMapControl)? This is the control which renders the map.

2. What is an Overlay (GMapOverlay)? This is a layer on top of the map control. You can have several layers on top of a map, each layer representing, say, a route with stops, a list of stores etc.

3. What are Markers (GMapMarker)? These are the points on a layer, each representing a specific geo location (Lat,Lon) e.g. each drop point on a route.

4. What is a route (GMapRoute)? This is the path or direction between two or more points.

5. WTF are tiles? – well here is something to read…Bing Maps Tile System.

 

map_Layers

The good stuff

When you download the binary from codeplex (this post is on WinForms) you will find several files in the folder. You only need the following

  • GMap.NET.Core.dll
  • GMap.NET.WindowsForms.dll
  • x86 and x64 folders for the version at the time of writing this post. These folders include the System.Data.SQLite.DLL which is used for local caching of the data to reduce the request for map tiles.

Now, add the GMap.NET.WindowsForms.dll to your Visual Studio IDE toolbox. Create a new project VB.NET or C#, whatever your fancy and drag the GMapControl onto the form.

This is how my toolbox look 

8-4-2011 2-48-46 AM

 

 


For sake of clarity I am going to name the control myMap.

You first need to Initialize the control

VB.NET

With myMap
      .SetCurrentPositionByKeywords("USA")
      .MapType = MapType.BingMap
      .MinZoom = 3
      .MaxZoom = 17
      .Zoom = 4
      .Manager.Mode = AccessMode.ServerAndCache
End With

 

Note: You can set the default position of the map with (to list a few)

  • SetCurrentPositionByKeywords(“country”) - USA
  • SetCurrentPositionByKeywords(“state, country”) – Berlin, Germany
  • SetCurrentPositionByKeywords(“province, country”) – Alberta, Canada
  • Position = New PointLatLng(latitude,longitude) - New PointLatLng(54.6961334816182, 25.2985095977783)

Next you need to add overlays with markers to the map

Dim overlayOne As New GMapOverlay(myMap, "OverlayOne")

Note: The GmapOverlay takes the map control and an id as parameters.


Next you need to add markers to the overlay.

overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New PointLatLng(LatitudeValue, LongitudeValue)))


basically you are creating a marker (GMapMarkerGoogleGreen) which takes an latitude and longitude as parameters. Then I am adding that marker to the overlay (overlayOne).


In most cases you’ll need to add multiple markers to the overlay. You can do that with a loop e.g.

For Each customer In Customers
        overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New PointLatLng(customer.Lat, customer.Long)))
Next


in the above code, I am iterating a list of customers, creating a new marker and adding it to the overlay.


Note: It is recommended that you have your points (address) geocoded first to get better performance. it makes no sense having several hundred addresses geocoded on the fly each time you load your map if you are dealing with a large list. Some service like google, have rate limits as to how many geocode query you can send to their servers in a given day.

Finally, add the overlay to the map.

myMap.Overlays.Add(overlayOne)

That’s it! My next posts will be on

  • Removing/Hiding overlays
  • Changing the Markers
  • Adding labels
  • Caching
  • Routing

Here is a screenshot of how I am using it in one of my apps (work-in-progress)

8-3-2011 1-20-33 PM

8-2-2011 3-44-12 PM

Posted on Wednesday, August 3, 2011 7:50 PM | Back to top


Comments on this post: Using GMap.NET – Great Maps for Windows Forms & Presentation

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Dear Saif,

Your tutorial is very good although I work in C#. I am having trouble understanding of the gmap.net Control. although I can see a map in my form but I cannot position it to india. Also because of lack of proper documentation it is not easy.

Can you point out to some good examples or tutorials

thanx

saurabh
Left by saurabh gupta on Sep 14, 2011 10:02 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Dear,

I got the zoom part finally. Can you tell me where to get the source code for the gmap.net as i tried downloading their examples none of them are working in my vs2010. Also i tried to download through tortise but was unable to do so as it does not download and shows me error. Can you guide me towards a working source code.
regds

saurabh
Left by saurabh on Sep 27, 2011 7:13 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
http://greatmaps.codeplex.com/SourceControl/list/changesets#

p.s. all demos are working perfectly, thx Saif for examples

Left by radioman on Oct 17, 2011 12:32 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Can share your icons?
Left by Suker Yang on Oct 18, 2011 6:02 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
can you share Windows form code with markers kindly share
Left by Hussain Munaf on Dec 10, 2011 8:34 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hi, thanks for the control, it is really fantastic,

but I cannot find the property myMap.MapType = ....

!!!
Thanks
Left by logicchild on Jan 15, 2012 11:31 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Where is MapType ??
Left by Carlos A. on Feb 18, 2012 6:52 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
dear Saif,
I'm currently working desktop app using google map. Your tutorial's very helpful but i can't drag it. Can you help me and share more examples pls pls...
Left by ENKHEE on Feb 27, 2012 2:42 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
hi.
same logicchild, .maptype not found...

T.Y.
Left by Giulio on Feb 29, 2012 2:11 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Anyone know if this control has any built-in methods for determining if a PointLatLng falls within a GMapPolygon?
Left by Steve on Mar 07, 2012 9:23 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
@Steve - You'll need to check for points within the polygon

/// <summary>
/// Determines if a Point is inside a polygon.
/// </summary>
/// <returns>Return True if the point is inside Polygon.</returns>
public static bool IsInsidePolygon(PointF[] polygon, PointF point)
{
using (GraphicsPath gp = new GraphicsPath())
{
gp.AddPolygon(polygon);
return gp.IsVisible(point.X, point.Y);
}
}

Left by Saif Khan on Mar 07, 2012 9:54 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Wow Man!

This is great! Very good your tutorial.
Left by Pedro Pablo on Apr 25, 2012 4:04 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hi

How to work with asp.net, i want to do website but i can't do.
Help me please.
Left by Edisson on May 09, 2012 6:12 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hello, My Name is Santiago! I m From Argentine! Excuise Me...Do you have de Code? I don under stand the inicialization....un WinForm!

Thank!
Left by Santiago on May 15, 2012 8:47 AM

# Drawing custom routs
Requesting Gravatar...
hello every body. please exuse me becose i cnow that my englich is so bed :(

hear is my problem: i want to create routs from a list of LatLngPoints.

I do it and i can calculate distance but routes are not visible on my map.

this is my C# code:
#region il y a des routes
IEnumerable<XElement> RoutesRq = from xElement in xDoc.Root.Descendants("Route") select xElement;
bool HasRouts = false;
if (RoutesRq.Count() > 0)
{
HasRouts = true;
int i = 1;
foreach (XElement route in RoutesRq)
{
List<PointLatLng> points = new List<PointLatLng>();

foreach (XElement p in route.Elements())
{
var latitude = Convert.ToDouble(p.Value.Split(',')[0].Replace('.', ','));
var longitude = Convert.ToDouble(p.Value.Split(',')[1].Replace('.', ','));
points.Add(new PointLatLng(latitude, longitude));
}

GMapRoute Grout = new GMapRoute(points, "R_" + i);
routes.Routes.Add(Grout);
i++;
}
gMapControl.Overlays.Add(routes);
//gMapControl is my GMap.NET.WindowsForms.GMapControl object
}
#endregion il y a des routes
help me plees. thanks a lot.
Left by speloman on Jun 04, 2012 8:39 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
.mapType property doesn't exist, you must have to use :
this.gMap.MapProvider = GMap.NET.MapProviders.BingMapProvider.Instance;
for exempla
Left by May be it can help on Jun 05, 2012 1:51 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
There is no .maptype in the latest releases. How do you set the map provider? I have tried everything I could find.
Left by KK on Jun 25, 2012 6:26 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
I can't Add the GMapControl to the toolbox ??
Left by Muhammad on Jul 14, 2012 11:17 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
I just started looking at this two days ago so my info is AFAIK based but after a bit of experimenting I got the following to work.
I am using Visual Basic.
Replace XLAT and XLON with whatever coordinates you want
After adding references to the project try...

Imports GMap.NET.WindowsForms
Imports GMap.NET.WindowsForms.Markers
Imports GMap.NET.WindowsForms.ToolTips
Imports GMap.NET
Imports GMap.NET.MapProviders
Imports System.Web.Extensions
Imports MySql.Data

Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
With myMap
.SetCurrentPositionByKeywords("USA")
.MapProvider = GMapProviders.GoogleSatelliteMap
.MaxZoom = 21
.Zoom = 10
.Manager.Mode = AccessMode.ServerAndCache
End With

myMap.Position = New GMap.NET.PointLatLng(XLAT, XLON)

Dim overlayOne As New GMap.NET.WindowsForms.GMapOverlay(myMap, "OverlayOne")
overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New GMap.NET.PointLatLng(XLAT, XLON)))

myMap.Overlays.Add(overlayOne)

End Sub
End Class
Left by Jerry on Jul 19, 2012 8:57 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
It's very helpful!
But I'd like to see the next post of "Adding labels" and change marker, I'm not find the next post by search.
Would you please post it? Or send some clue to me , thanks
Left by Teng on Aug 12, 2012 8:53 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Anyone knows how to show a custom info window (with tabs or something like you can do on a web application) when clicking a marker using this control ??
Left by will on Sep 03, 2012 10:08 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
hi
thanks for ur tutorial but i have a problem with the maptype
Left by ahmed on Nov 14, 2012 1:43 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
i am very new in mapping pls explain further.
Thanks
Left by ahmed on Nov 14, 2012 10:24 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
hello,

How to add labels to markers?

Best Regards,
Marco Gaspar
Left by Marco Gaspar on Nov 23, 2012 7:52 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Great !
Can you share your code, thank you very much !
Left by Tuyen on Nov 23, 2012 4:24 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
hi!!!! That is so great!!!!!
hey
how declare "position"?
i try to do something like that but , some line i can't understand Y -Y
I am student from university
my email :lu_ponce88@hotmail.com

Left by lu on Dec 08, 2012 7:59 AM

# How to add labels to markers?
Requesting Gravatar...
'Define Marker like explained above:

Dim overlayOne As New NET.WindowsForms.GMapOverlay(GMapControl1, "OverlayOne")

overlayOne.Markers.Add(New GMap.NET.WindowsForms.Markers.GMapMarkerGoogleGreen(New GMap.NET.PointLatLng(51.2961334816182, 7.0985095977783)))

'You can use overlayOne.Markers.Count to determin loops
overlayOne.Markers(0).Tag = "Point=1;ID=47"
overlayOne.Markers(0).ToolTipText = "Point 1"

GMapControl1.Overlays.Add(overlayOne)

'ToolTipText is shown when mouse is over Marker

'To handle click-event of markers use GMapControl_OnMarkerClick

Private Sub GMapControl1_OnMarkerClick(item As GMap.NET.WindowsForms.GMapMarker, e As System.Windows.Forms.MouseEventArgs) Handles GMapControl1.OnMarkerClick

MsgBox("Marker clicked: " & item.Tag.ToString, MsgBoxStyle.Information, "Marker " & item.ToolTip.ToString)

End Sub

Greets Lotto
Left by Lotto on Dec 09, 2012 11:36 PM

# lu: how declare "position"?
Requesting Gravatar...
Hi lu,

Me.GMapControl1.Position returns / sets the center of the map.

You can declare a Point like that:

Dim pnt as New GMap.NET.PointLatLng(Y, X)

You can set the center of the map to a point:

Me.GMapControl1.Position = pnt

You can store the actual position of the map into a point:

pnt = Me.GMapControl1.Position

You can move around a map by moving the position. The following code moves the position of the map to the right (east).

const cMoveStep as double = 0.05

Me.GMapControl1.Position = New GMap.NET.PointLatLng(Me.GMapControl1.Position.Lat, Me.GMapControl1.Position.Lng + cMoveStep)

Me.GMapControl1.ReloadMap()

i hope it helps
greets Lotto
Left by Lotto on Dec 10, 2012 4:00 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
how can i get the marker centered on the map ?

thanks in advance
Left by Mostafa Atef on Jan 12, 2013 4:36 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hi anyone know how to return the Lat and Long value when user clicking on the map? Preferably using C#.
Left by Denny on Jan 15, 2013 1:47 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Anyone know how to get Long and Lat value when user clicking on the map? Using C# or VB is ok.
Left by Denny on Jan 15, 2013 1:53 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
i can drag map and also can add markers in it .... but here is my problem
..........................................................................................................
i have added more than 10 markers
&
also added their click event .....
but i am failed to judge that which marker (region) is clicked from 10 markers .....
i think it is possible by getting the latitude and langitude or by adding unique label in every label.....please help how to get langitude and latitude of a marker
or
add unique label in a marker and how to read this marker

i have tried it very much but till now no success
my mail amir@cedsg.com
Left by Amir on Mar 20, 2013 8:27 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hello Saif, I need to use the control to display a map using a shape file and integarte with my desktop application to custom visualize spatially data from sql database.You know i want with show all mapping elements in my print lik Title, Legend and the different symbologies.Can you tell a good guide to accomplish this.kindly share code fragment.Thank you.
Left by Jonas on Mar 29, 2013 11:37 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
To extract Lat/Long from a map double-click:

// In MainMap setup...
MainMap.MouseDoubleClick += new MouseEventHandler(MainMap_MouseDoubleClick);

...

// When the user double-clicks, get the location, move
// TargetMarker to that location and save GISLocation.
private void MainMap_MouseDoubleClick(object sender, MouseEventArgs e)
{
// Set the long/lat value based on the click location and replace the marker.
TargetMarker.Position = MainMap.FromLocalToLatLng(e.X, e.Y);
GISLocation = TargetMarker.Position;

// ???? Do more here.
}

Paul T.
Left by Paul T. on Jun 07, 2013 5:16 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
I'm struggling with removing overlays and I noticed you will be covering this in an upcoming blog. Do you have a sense of when that might be? Is there a method for clearing the map with a button click event?
Left by Jcarter on Jun 12, 2013 5:14 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Adding multiple markers from datagridview. I have a sql table which has 1000 latitudes, long values I want all of them to display on the mapcontrol. can I do them on gmap i tried several ways but i cant do it.


if (comboBox5.SelectedIndex == 0)//(REGION 1)
{


String Query = " SELECT top 1000 Latitude,Longitude FROM [ICPS].[dbo].[Sheet3_kir] ";

SqlCommand cmdDatabase = new SqlCommand(Query, conDatabase);
SqlDataReader myReader;
gMapControl1.MapProvider = GMap.NET.MapProviders.BingMapProvider.Instance;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;

GMapOverlay markersOverlay = new GMapOverlay("VCS MAP");
gMapControl1.Overlays.Add(markersOverlay);


for (int i = 0; i <= dataGridView1.Rows.Count; i++)
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
var Latitude = double.Parse(dataGridView1.Columns[1].ToString());
var Longitude = double.Parse(dataGridView1.Columns[2].ToString());
gMapControl1.Position = new PointLatLng(Latitude, Longitude);
GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(float.Parse(this.dataGridView1.Columns[1].ToString), float.Parse(this.textBox26.Text)),
GMarkerGoogleType.green);
GMarkerGoogle m = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.green_pushpin);
//markersOverlay.Markers.Add(m);
}
}
Left by kiran on Jul 03, 2013 7:24 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hey nice tutorial ...... i successfully added the markers and stuff .. but there's one problem .... it always points d marker at the centre and then when i zoom in or out it show the actual position
Left by Raymond on Jul 27, 2013 12:21 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Dear Sir .
I developed a test program in vb.net 2010 and using the last GMAP.dll's version.
I inicialice the map with a position .OK. But I have this problem : I am able to add only a mark .
This is the code
Dim o1 As New GMap.NET.WindowsForms.GMapOverlay("o1")
o1.Markers.Add(New Markers.GMarkerGoogle(New GMap.NET.PointLatLng(27.8, -15.39), GMarkerGoogleType.green))
o1.Markers.Add(New Markers.GMarkerGoogle(New GMap.NET.PointLatLng(27.91248, -15.4117), GMarkerGoogleType.blue))
GMap1.Overlays.Add(o1)
It only show 1 mark .
Why?
Thanks in advance
Left by santiago on Aug 30, 2013 4:28 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
is there a way to print this map?
Left by Roshan on Sep 12, 2013 6:54 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Is there a way of centering the map on the provided lat long?

I have found that the .Position sets the 0,0 position of the map control to the provided lat long X,Y

Dim pnt as New GMap.NET.PointLatLng(Y, X)
Me.GMapControl1.Position = pnt
Left by Martin on Sep 18, 2013 4:57 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Is there a way to print or save map generated ?
Left by Roshan on Sep 19, 2013 9:55 PM

# GMapControl.MapType deprecated - use MapProvider
Requesting Gravatar...
Saif ---

thanks for a great get-started post!

Since you've written this, it looks like GMapControl.MapType has gotten deprecated (apparently replaced by GMapControl.MapProvider).

I was able to get your demo working with the following:

m_wGmap.MapProvider = GMapProviders.OpenStreetMap;



Thanks again for your community spirit, and a great, concise intro!

-- Carl
Left by Carl Niedner on Oct 17, 2013 9:43 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Khan Saab,
how ru? I m having a problem with my sample application of GPS travel map, when I run it shows me error (Webserver not found" in blue screen instead of showing map. I an actually not able to understand where is gone wrong with my code,,

please help me out..
thanks in advance.
Left by G Krishna Rao on Jan 20, 2014 12:22 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
great work!

can i have a source code of your GMap.NET.WindowsForms?
it will be of great help to my thesis study..thank you
Left by azz on Feb 11, 2014 4:12 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hi guy! I have project Using GPS device to confirm location. So, I don't know how to use function geocoding and Reverse ò Google map
So need your help?
Thank's
Left by Pham Tuan Anh on Apr 08, 2014 6:13 AM

# How to limit map boundaries inside control....
Requesting Gravatar...
myMap.BoundsOfMap = new RectLatLng(new PointLatLng(90, -180), new GMap.NET.SizeLatLng(-90, 180));

Thanks for any help!!!!
Left by Crazy on Apr 29, 2014 7:31 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
hi. please help me. I am new in map programming. I download greatmap samples. I downloaded tiles with help greatmap. I publish this greatmap presentation samples to iis. But i dont show my downloaded map in other pc. I need publish this samples to iis. Access them from another computers which havent internet access as mapserver. How i do it. please help
Left by Kamran on May 26, 2014 1:12 AM

# Removing/Hiding overlays
Requesting Gravatar...
I still waiting for your •Removing/Hiding overlays tutorial
Left by Ravan on Jun 17, 2014 10:34 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Thanks alot for your tutorial it was really good and helpfull,Can you please tell me that is it we get UTC offset(TimeZones) of particular point by giving its Lat and log.
Left by Ravi on Jul 22, 2014 5:40 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
I am having trouble getting a Google map to display using VB 2010. The following code was adapted from several different pages. The problem is that no map is displayed, just a blank screen with the Google text at the bottom. I imported GMap.NET and GMAP.NET.WindowsForms. Mymap is the name of my GMap control on the form.

Private Sub frmGPS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, NumericUpDown1.ValueChanged

Dim xstart As String = "Avenida Armando Tivane, Maputo, Mozambique"
Dim xend As String = "Rua 1301, Maputo, Mozambique"
Dim route As MapRoute = GMap.NET.MapProviders.GoogleMapProvider.Instance.GetRouteBetweenPoints(xstart, xend, False, False, 15)
Dim r As new GMap.NET.WindowsForms.GMapRoute(route.Points,"My Route")
Dim routesOverlay As New GMapOverlay(MyMap, "Routes")

MyMap.MapProvider = MapProviders.GoogleMapProvider.Instance
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly
MyMap.SetCurrentPositionByKeywords("Maputo, Mozambique")

routesOverlay.Routes.Add(r)

MyMap.Overlays.Add(routesOverlay)

End Sub
Left by MWulfe on Aug 02, 2014 5:48 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hi all
I am using the GMap in VS2912 VB.Net. I added the control to my toolbox and created a from, which now has the map control. I am trying to load a map with London as a keyword (UK Map). I tried OpenStreetMap Provider Instance and BingMapProvider.Instance (and a few more) but all the tiles come up with the same message: Exeption: Operation has timed out - and below that "We are sorry but we don't have imagery at this zoom level for this region."

Is this a known issue? How do I resolve this? Could it be a firwall issue or a missing entry in a Hosts file?

Any help will be appreciated

Many thanks
Len
Left by Len on Aug 22, 2014 3:51 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Hello,
It was a great tutorial for the beginners like me. I have one question.. is there any way to use GMap in web application (asp.net)... ??
If so then can you provide or suggest me for a sample of that.. ??
Thank You.
Left by Rasoo on Dec 08, 2014 8:48 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
How can I use the Drag option with mouse left button click?
Left by Rasoo on Dec 08, 2014 9:19 PM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
But this is not working with wpf as it working in winforms, that doesn't support marker and polygon in wpf..
Left by Prakash N on Jan 07, 2015 12:54 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
In google Map , I can See Some Image below the Google map from show image Option. how i can get It in My Application. I am working On C# windwos Application
Left by Sojeb on Mar 29, 2015 6:36 AM

# re: Using GMap.NET – Great Maps for Windows Forms & Presentation
Requesting Gravatar...
Is it possible to move the map around using the left mouse button instead of the right one? I know setting CanDragMap to true will allow it to be dragged with the right mouse button, but can this be changed to the left one?
Left by goondoo27 on Apr 24, 2015 4:46 PM

Your comment:
 (will show your gravatar)


Copyright © saifkhan | Powered by: GeeksWithBlogs.net | Join free