Search code examples
pythontkinterkmlgoogle-earthgpx

Python viewing a .gpx or .kml using Python possibly using Tkinter


I am using both Python 2.7 and Python 3.3 on windows 7.

I have installed many GIS modules for python, including earthengine,gpsbabel and pygoogle earth.

Using gps babel I have made several .gpx and .kml files from .csv files that imported into a panda dataframe. I was able to merge all of the files (which contain waypoint and route info) into a merged.kml and merged.gpx file using gpsbabel

I checked to make sure that the master files are good by dragging and dropping them into google earth. Everything looks good so far!

Now i really like to know how to view my waypoints and routes in a window created by python perhaps using Tkinter.Maybe that is too hard?

I am looking for an example that will load the .kml or .gpx ( i dont care which). here is my idea in pseudo code:

    from googlemaps import GoogleMaps as gm
    gm.read_kml(name_in)
    gm.show()

Solution

  • All you need to do in order to view a .kml in google earth

        import os
        os.startfile("C:\Users\Owner\Documents\Python Scripts\google earth\L1.kml")
    

    This uses the operating system, to open the file. So it will only work when the .kml file opens using google earth by default. In fact os.startfile will open any file type using the program that it defaults to