1

I'm sort of newbie to programming & while making my way to learning, I'm stuck at a point. I've made an android application to send GPS co-ordinates of a device to my web-server. Now, I'm onto developing a native Windows app using Forms to fetch geo-locations from the server & show a map to the user. I'm successfully fetching JSON from the server, writing data to a cache (text) file locally & reading the points. But no way I can find to show map from the data!

I searched a lot, found GMap.NET library, but no working samples for VB.NET to make it that clear for me understand.

I know, it would have been easier through a web control, but I really need to keep it non-IE driven.

I'd love to have your suggestions.

Joel Coehoorn
  • 362,140
  • 107
  • 528
  • 764
VPZ
  • 602
  • 7
  • 18

1 Answers1

2

The documentation for the GMap.NET is quite lacking but if you take the time to explore the properties and methods it provides appears quite easy to use.

Here's a quick sample that should get you started:

First of all, create an empty Form in a VB.NET solution and add a reference to the three DLLs provided by the GMap.NET library.

Then, paste this code into your Form1.vb:

Imports GMap.NET
Imports GMap.NET.MapProviders

Public Class Form1
    Private map As GMap.NET.WindowsForms.GMapControl

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        map = New WindowsForms.GMapControl()
        Me.Controls.Add(map)

        map.Dock = DockStyle.Fill

        With map
            ' Home sweet home...
            .Position = New PointLatLng(19.442288, -70.652266)

            .MapProvider = MapProviders.GoogleMapProvider.Instance
            .MinZoom = 3
            .MaxZoom = 17
            .Zoom = 16
            .Manager.Mode = AccessMode.ServerAndCache
        End With
    End Sub
End Class

For further assistance with the control you should contact the authors directly: http://greatmaps.codeplex.com/discussions

xfx
  • 1,260
  • 6
  • 17
  • Okay these things I got to work, but UI almost freezes for a while doing that. using background doesn't seem to be possible. – VPZ Jan 13 '13 at 04:17
  • I also felt it ran quite slow. Try changing the `MapProvider` property to `GMapProviders.OpenStreetMap` and see if that speeds it up a bit. – xfx Jan 14 '13 at 13:27
  • Hey! thanks for the assistace you were giving me back. i figured it out to do it in background worker. Actually, I just got to know how to pass object to B-Worker! And, it's working all good with Bing (I just love 'em!). :) – VPZ Jan 16 '13 at 18:36
  • That's great @VaibhavPandey! – xfx Jan 17 '13 at 02:45