Forum Archive

Google Earth KML: best module? (simplekml installation issues)

Wizardofozzie

I'm trying to edit and create Google Earth KML (keyhole markup language, based on XML); on Windows with iPython I usually use simplekml, however I'm having a tough time trying to install this, as the tar.gz doesn't want to open when using downloadista.pypi("simplekml", "1.2.8").

Any suggestions for using Pythonista with KML files would be greatly appreciated

omz

The simplekml package is distributed as a Zip file (not tar.gz), maybe pypista can't handle that?

Anyway, you could try this simple installer script:

import urllib
import zipfile
import os
import shutil

urllib.urlretrieve('https://pypi.python.org/packages/source/s/simplekml/simplekml-1.2.8.zip', 'simplekml.zip')
with zipfile.ZipFile('simplekml.zip') as z:
    z.extractall()
shutil.copytree('simplekml-1.2.8/simplekml', os.path.expanduser('~/Documents/site-packages/simplekml'))
shutil.rmtree('simplekml-1.2.8')

The module seems to work, but I haven't tested it extensively.

Wizardofozzie

I forgot to report back; the script does work, but there are a few issues with simplekml (mainly because or recursion limit and it doesn't like the unwieldy default directory length, I'm told, though these are iOS limitations, not Pythonista😉)

Thanks for the input, much appreciated