Пропустить навигацию.
Главная
Ученье - свет...

Extracting Geographical Lat-Long data from Google Earth KML / KMZ files to Excel

If you have some data in table format with IDs for fields or point locations on the map and Google Earth KML file with those fields having same IDs, it is generally possible to bring spatial information to Excel and merge those data sources together to use in further spatial analysis in other GIS software and in newly released FREE ESRI Maps for MS Office Beta 2. There are a few little tricks to it, though…

Google Earth KML files are essentially XML files with geographical information, but Excel will not open them directly.

image

If you click Yes, Excel will recognize the file as XML, but will fail to import it nevertheless. 

imageimage

So, you will need to re-name the KML file so it has XML extension. Right click the KML file and select “Open with” Notepad:

imageIt will show XML formatted text in Notepad. image

Go to File/Save As and select “all files” option.

imagethen type NEWFILENAME.xml together with extension image

Open a new MS Excel file (or the file with your tabulated data information you want to bring KML location data in). In File tab, hit Open and open the NEWFILENAME.xml file. It will recognize it as XML table and suggest schema. Agree to everything! Winking smile If all goes well you should see the table with all your data similar to

image

If your data had polygons, each field will have two lines, sort by coordinates column and erase empty lines. You will end up with a table like this:

image

Notice, that both Latitude and Longitude in in the same column, separated by comma. In Excel 2010 you can separate those rather easily. Insert empty column to the right of the merged coordinates column. Highlight the coordinates column, go to  Data tab and click Text To Columns, pick Delimited, and Separated by Comma.

image

Now you have it – two separate columns with exact geographical coordinates in Decimal Degrees, to merge with your other data in Excel. Name them X-Longitude and Y-Latitude (remember, in western hemisphere, Longitude is negative!)

image

Converting KMZ file to KML

The procedure described above will not work on KMZ files directly. When you open KMZ (zipped KML file) in Notepad, you will not see XML formatted text as in example above, but some gabled code like:

image

To convert KMZ to KML you will need Google Earth installed. Bring KMZ to the map, right click on the layer you want to convert and select “Save Place As”

image and “Save as KML” from drop down list. This will generally blow up the file size about 3 times. To bring those Coordinates to Excel, follow the instructions above for KML file.

Troubleshooting

image

If import fails read the Log info, for me it has happened when field names had spaces, like "11Z365 D"… Thanks to readers of this blog (Michael Bruening) there is a solution how to get rid of spaces in Excel: you could always select the column/row within the excel spreadsheet and do a “Find and Replace” of a [space] with an [underscore].

If you have ESRI ArcMap installed, you can go to Toolbox\Conversion Tools\From KML to Layer

image

Then go to Point Table, add XY coordinates to Centroids (procedure in previous post), and finally export that table to Excel.

If you need futher assistance with your KML data, please, do not hesitate to contact Landviser, LLC - post comment, email info@landviser.com, or call 609-412-0555.

 Current complete catalog of Landviser LLC

Hello,useful post! I

Hello,useful post! I recommend to have a look at gpx2kml.com , a free converter tool that can turn your gpx to kml files. It is free, easy to use, it comes with a simple interface and there's no installation needed. It converts also kml to gpx format, when needed. Thanks!