FiRE-HNL / alaska-wildfire-occurrence

Wildfire occurrence modeling using Terrestrial Ecosystem Models and Artificial Intelligence
Apache License 2.0
0 stars 0 forks source link

Support KMZ reads #41

Open jordancaraballo opened 1 year ago

jordancaraballo commented 1 year ago

Two steps: (1) enable KML drivers for fiona: fiona.drvsupport.supported_drivers['kml'] = 'rw' # enable KML support fiona.drvsupport.supported_drivers['KML'] = 'rw'

(2) Unzip the KMZ file to find the embedded KML file (my example assumes this to be called doc.kml but that may not always be the case) from zipfile import ZipFile kmz = ZipFile(kmlFilename, 'r') kmz.extract('doc.kml', tempDir)

Now you should be able to open the kml file with fiona, or geopandas etc import geopandas as gpd gdf = gpd.read_file(os.path.join(tempDir,'doc.kml'))