Search code examples
python-2.7kmlgoogle-earth

how to load the kml file into google earth using python


I am creating a kml file in my python script. and then opening it manually in google earth.

is there a command in python to load kml file to google earth during runtime.


Solution

  • os.startfile("Path to the kml file") or webbrowser.open("Path to the kml file") both will load the kml file in google earth. However, this needs that the kml files are by default set to open with google earth.

    If in case kml files are by default not set to open with google earth, os.system("Path to the GoogleEarth.exe file" + "path of the KML file") will open it in Google Earth. There are other ways also to do this task.

    This link provides good solutions to open files with respective applications.