Import a GPX file

Topics: Windows Forms
Apr 11, 2011 at 3:00 PM


The tool is realy greate! Thanks for your work!

Till now I can set and delete Marker, manage Waypoint etc, but I am not enabled to manage a treck from a GPX File.


If there anywhere a small example to load a treck from a gpx file to display the track on the map in VB.NET ??


Many thanks!



Apr 11, 2011 at 3:39 PM

in nop, but there is import function for gpx in demo.windowsForms

Apr 11, 2011 at 10:05 PM

Thanks for your quick response.

Waht do you mean with "in nop"??

demo.windowsforms is a compiled version.

Is there any way to bring the function of importing a GPX track in a own VB.NET project ??


Thanks in advanced



Apr 12, 2011 at 2:39 AM


Did you download the GMap source? If not - click on the Source Code tab and 'download' below "Latest Version" on the right of the page.

I have written C# code that read a gpx file, makes some adjustments where needed, and loads it into GMap for display. This was based on what you will find in Demo.WindowsForms so feel free to ask for more help if needed.

Apr 12, 2011 at 9:39 PM


I found a solution.

For all other with same problems:


        Dim G As GMap.NET.GMaps
        Dim Gpxt As New GMap.NET.gpxType
        Dim trk As New GMap.NET.trkType
        Dim tSeg As New GMap.NET.trksegType
        Dim WPT As New GMap.NET.wptType
        Dim gpxSTR As String
        Dim X As String
        'Dim RT As GMap.NET.MapRoute
        Dim P As New GMap.NET.PointLatLng

        Dim Punkte As New List(Of GMap.NET.PointLatLng)

        FileOpen(1, "d:\test.gpx", OpenMode.Input)
        Do While Not EOF(1)
            X = LineInput(1)
            gpxSTR = gpxSTR & X

        Gpxt.trk = GMap.NET.GMaps.Instance.DeserializeGPX(gpxSTR).trk

        For Each trk In Gpxt.trk
            For Each tSeg In trk.trkseg
                For Each WPT In tSeg.trkpt
                    P.Lat =
                    P.Lng = WPT.lon


        'Dim RT As New GMap.NET.MapRoute(Punkte, "TRK1")
        Dim RT As New GMap.NET.WindowsForms.GMapRoute(Punkte, "TRK1")
        Dim TReKtop As New GMap.NET.WindowsForms.GMapOverlay(Me.GMapControl1, "TReKtop")




Many thanks at all for the help!!!!!


Apr 13, 2011 at 7:20 AM

no need to call GMapControl1.Refresh()