You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcCatalog Data Creation & Import/Export forum

How to import KML files   J Paneque Nov 12, 2007
Re: How to import KML files   Eric Powell Nov 13, 2007
Re: How to import KML files   J Paneque Nov 13, 2007
Re: How to import KML files   Eric Powell Nov 13, 2007
Re: How to import KML files   J Paneque Nov 13, 2007
Re: How to import KML files   Brian Kaplan Apr 24, 2009
Re: How to import KML files   Ian Reid May 04, 2009
Re: How to import KML files   barbara haney Nov 13, 2007
Re: How to import KML files   Chad Phelan Feb 07, 2008
Re: How to import KML files   Jeff Blossom Aug 26, 2008
Re: How to import KML files   Jeff Blossom Sep 19, 2008
Re: How to import KML files   SanjayKumar Rajbhar Sep 03, 2008
Re: How to import KML files   Roberto Uzcategui Oct 15, 2009
Re: How to import KML files   Chris Watson Jan 29, 2010
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject How to import KML files 
Author J Paneque 
Date Nov 12, 2007 
Message Hi there

I am trying to import KML files (polygons retrieved from Google Earth) as shapefiles into ArcGIS 9.2 and am not very sure how to do this. The only way I've found for polygons so far is to use the KML2SHP Converter by S.Srinivasa Rao, which I downloaded from this website. However, the tool doesn't seem to work for any reason, despite I've got the .NET framework 3.0 installed on my PC. Can anyone suggest what the problem may be and/or if there is an alternative way of doing this?

Many thanks.

Jaime 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Eric Powell 
Date Nov 13, 2007 
Message There is a set of geoprocessing scripts at

http://sourceforge.net/projects/pygearth

Documentation is sparse, but the tools are there.
There is also a ArcToolbox included in the distribution.

It uses the stand python installer process:

python setup.py -install

Eric Powell
Savannah River National Laboratory 
  Eric Powell
Savannah River National Laboratory 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author J Paneque 
Date Nov 13, 2007 
Message Thanks Eric

Have downloaded now the file and extracted it but to be honest have no idea how to follow the installation process. Do I have to do it from ArcMap 9.2 or ArcCatalog 9.2? Can you please outlilne the steps I have to follow to make the scripts available? Really appreciate it.

Many thanks

Jaime 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Eric Powell 
Date Nov 13, 2007 
Message being a BAD developer...I haven't written the documentation yet,but...

First, you will need to download the ElementTree library for Python and install that. ElementTree (for Python 2.4) can be found at:

http://effbot.org/downloads/#elementtree

(get the 1.2.6 for win32 version) and run the exe installer.

Once you have installed elementtree, install the pyGEarth libraries:

1) Extract them to a directory
2) Open a win32 shell and cd to the directory from above
3) in the shell type:

python setup.py -install

4) The setup script should put all of the files in the following directory:

C:\pythin24\Lib\site_packages\pyGEarth

Once installed the library provides several classes (each in it own python (*.py) file. To read KML, you would need to write a short script to use the classes (an example is shown below).

I hope to get some documentation written on the classes this weekend...

NOTE: This tool ONLY HANDLES THE GEOMETRY and attributes in the Name and Description tags. Cartography support has not been implemented.

NOTE: If the KML in the file is version 2.1, then use the KMLReader21 class instead of the KMLReader20 class.

Eric Powell
Savannah River National Laboratory 
 
import sys, os, string
from pyGearthGeometry import *
from pyEarthReadKML import *
from pyGEarthESRITools import *


if __name__ == '__main__':
    objPKLLine = KMLReader20(filename,'Polygon', 'Placemark', 'Folder')
    #Now, iterate through the line collection and add the attributes
    lstKRows = objPKLine.getData()
    geo_processing_tools = write_geometry(lstKRows, 'Polygon', outdb)
 
  Eric Powell
Savannah River National Laboratory 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author J Paneque 
Date Nov 13, 2007 
Message Thanks for that Eric. It does look a bit overwhelming to me to be honest... but will certainly give it a go as soon as I have a bit of time. Will let you know how it works. Cheers

Jaime 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Brian Kaplan 
Date Apr 24, 2009 
Message I'm trying to use pyGEarth for import KML to shapefiles or geodatabases. When I try to install it under python25, I get the following errors

Unknown Geometry Tyep: ', GeometryType

Invalid Syntax

warning: install_data: setup script did not provide a directory for "" -- installing right in'C:\python25

error: can't copy "" doesn't exist or not a regular file.

The files do show up in the site-packages folder but the modules are not recognized when imported via the python command line as show in Eric Powells post. Any idea on how to fix this?

I don't have the money for the interop extension. I've tried the xTools trial and the Arc2Earth trial and they both work great. However, I'm looking to implement as a script or in ModelBuilder. xTools doesn't have that feature yet. Arc2Earth does but it is in the Enterprise edition which is a little to expensive for me and my group. Arc2Earth is very very good in that you can provide a kml url address and it will download and convert the file to a geodatabase or a SDE. There is also a feature to schedule it on a regular basis. Again these features are in the Enterprise edition only.
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Ian Reid 
Date May 04, 2009 
Message I'm getting the same install errors in Python 2.4. The modules are unknown to Python when I try to import them. Have you had any further success? 
 
File "C:\_folders\kml\Script1.py", line 2, in ?
    from pyGEarthGeometry import *
ImportError: No module named pyGEarthGeometry
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author barbara haney 
Date Nov 13, 2007 
Message KML files can also be imported using the "Data Interoperability Tools" - Quick Import tool. I've successfully used this tool for both points and polygons.

Barbara 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Chad Phelan 
Date Feb 07, 2008 
Message Barbara, how were you able to import kml with the quick import tool? I don't see kml as an available format to import from.

thanks 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Jeff Blossom 
Date Aug 26, 2008 
Message Click Tools > Extensions, check Data Interoperability, and Close. Then KML will be an available input format. However, the Quick Import tool was created when KML was version 2.0, now it's version 2.2, and will bomb. Unless you do what is listed here:
http://gis.harvard.edu/icb/icb.do?keyword=k235&state=popup&topicid=icb.topic109643&view=view.do&viewParam_name=KML_compatibility&viewParam_fname=

The KML will then be imported, with the kml_desc and kml_name fields populated with the corresponding attributes from the KML.

***The attributes are not imported using this tool with ArcMap 9.3*** 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Jeff Blossom 
Date Sep 19, 2008 
Message I stand self-corrected from my earlier post. KML with attributes DO import with Data Interoperability extension in 9.3. Here's how to do it:
http://isites.harvard.edu/fs/docs/icb.topic109643.files/Import_kml_to_ArcMap.pdf 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author SanjayKumar Rajbhar 
Date Sep 03, 2008 
Message hi

u should download X Tool Pro form Net. just search in Google. and get it installed it works fine.

regards
SanjayKumar rajbar 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Roberto Uzcategui 
Date Oct 15, 2009 
Message Hi,

You can use this application that i've founded and works:

http://www.zonums.com/online/kml2shp.php

Is 100% free 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: How to import KML files 
Author Chris Watson 
Date Jan 29, 2010 
Message I recommend ET GeoWizards (http://www.ian-ko.com)

"Import from Google Earth" is on the "In/Out" tab

The GUI was not responsive (unregistered version; both fields were blank after selecting in and out vars) but I hit the Finish button anyway and got my new feature class.