I am trying to add an image icon overlay into an existing KML file (that contains polygon layer from shapefile) without having to overwrite the file. I am currently using the "simplekml" python module which is giving me what I want.

The following code:

import simplekml

kml = simplekml.Kml()
screen = kml.newscreenoverlay(name='ScreenOverlay')
screen.overlayxy = simplekml.OverlayXY(x=0,y=1,xunits=simplekml.Units.fraction,
screen.screenxy = simplekml.ScreenXY(x=15,y=15,xunits=simplekml.Units.pixel,
screen.size.x = -1
screen.size.y = -1
screen.size.xunits = simplekml.Units.fraction
screen.size.yunits = simplekml.Units.fraction

Is there a way I can read and write an existing KML file without having to recreate a new one. Is there a function that allows me to modify and save the KML file?

1 Answer 1


According to the creator of simplekml:

Unfortunately, simplekml is just a kml generator, it cannot read and manipulate existing kml, only create it. You will have to use an alternative, such as pyKML.

Source: groups.google.com/forum/#!topic/simplekml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.