My goal is to iterate over features in a given KML file and save each feature as a seperate KML file. I'm using python and it seems that ogr module can do it but I can't figure out how.
I am able to read a KML file into
<class 'osgeo.ogr.DataSource'> and
<class 'osgeo.ogr.Layer'> simply using:
import ogr fn = r'C:\Users\kml folder\terre.kml' driver = ogr.GetDriverByName('KML') dataSource = driver.Open(fn, 0) layer = dataSource.GetLayer()
I am also able to iterate over the features in the layer but from here on I can't seem to find the right way to save each feature as a separate KML.