Prototype Solar Mini Grid Layout (1st Implementation)

Pay Notebook Creator: Roy Hyunjin Han250
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0


Inspire a community of professionals skilled in spatiotemporal analysis for community health and safety.


Write a tool that converts the example KMZ datasets into a normalized format.


Roy Hyunjin Han


We have some example datasets and we would like to normalize them so that downstream modules know how to load them.


20170912-1715 - 20170920-1700: 1 week actual


_ Load example kmz datasets
_ Save kmz datasets
_ Build a tool that extracts specific information from a kml file


20170912-1715 - 20170912-1815: 60 minutes

_ kmltogeojson    
_ pykml
_ simplekml
_ pygis

+ Find packages for handling kmz files

20170912-2130 - 20170912-2200: 30 minutes

After evaluating a bunch of packages, I think we should use fastkml.

+ Decide which package we might use

20170920-1630 - 20170920-1700: 30 minutes

Maybe we can stick to GDAL for both loading and saving the KML. I don't feel like going into the specifics of KML format.

I think the reason fastkml exists is if you do not want any dependencies other than Python.

_ Use fastkml to load the example datasets

I probably could use fiona, but I would rather upgrade geometryIO as it has been on my list of things to do for a long time. But I would like to call it something different.

In [ ]:
from os.path import expanduser
dataset_path = expanduser('~/Experiments/Datasets/evi-20170819.kmz')
In [ ]:
# Try fiona
import pip
pip.main(['install', 'fiona'])
In [ ]:
import fiona
#  # Raises FionaValueError

It looks like fiona will not support kml:

In [ ]:
# Try geometryIO
import geometryIO

The geometryIO package makes more progress, but it looks like it is not loading any geometries. We might have to put KML to CSV/SHP.ZIP as a separate tool.

In [ ]:
import pip
pip.main(['install', 'fastkml'])
In [ ]:
cd ~/Downloads
cp ~/Experiments/Datasets/evi-20170819.kmz .
unzip evi-20170819.kmz
ls -l
In [ ]:
from fastkml.kml import KML
from os.path import expanduser
kml = KML()
kml_text = open(expanduser('~/Downloads/doc.kml'), 'rb').read()
In [ ]:
features = list(kml.features())
f = list(features[0].features())[0]
In [ ]:
x = list(list(list(f.features())[0].features())[0].features())[0]
In [ ]:
In [ ]:

It looks like kml is one of those strange nested file formats.

In [ ]:
x = list(list(list(f.features())[0].features())[0].features())[1]
In [ ]:
_ Examine KML of each example dataset
_ Try gdal
_ Load the different datasets
_ Save the different datasets

We decided not to accept kml files for now.