Converting KML to GMT

Next

A question that I keep seeing in my facebook feed and getting asked is how to plot GoogleEarth Keyhole Markup Language (KML) in GMT. It is actually very simple, and GMT provides a simple command called kml2gmt. This command is self-explanatory and just converts the the KML file to a set of longitude and lattitude pairs. For example if you type the following command into the terminal:

gmt kml2gmt mykmlFile.kml

You will see all the ordered pairs:

> -L"NLC WATERSHED"

-105.436079395 41.289608771

-105.434686459 41.290554744


I have provided a script with a sample KML file. You can download the .zip file with the c-shell and all files here.


The script will take a kml from the the GoogleEarth image on the top and plot it as a line in GMT, shown on the bottom.

GoogleEarthImage
convertKML



© Brady Flinchum 2016