KML Line Splitting Using a Python script

Hello everyone,

I am new to python and I need your support guys in a small task.
I drew a line manually on google earth around 10 m using the feature “Draw Line” by connecting 10 points so basically by clicking 10 times to get the complete line because I need the distance between each point to be 1 m.

Now the question is, how can I do that in a python script automatically ? I need to do it for longer lines and there must be a way to do it in python.

I would be very thankful for any assistance.
Thank you guys in advance

1 Like

If you’re doing this in KML, you need to:

There are also some KML related modules on PyPI:

Of these, the keytree module looks promising:

Cameron Simpson

1 Like

Thanks a lot man, I appreciate your help.
I will check them out and let you know how it goes.

Have a nice day.

Hello again,
I have tried it using the script below but I didn’t know how to add more coordinates using a function, I wrote some coordinates manually.
I need to add 20 coordinates on this route for example with a specific distance of 2m.

kindly let me know how I can go from here and thank you in advance.

import simplekml
from polycircles import polycircles
import subprocess
import pandas as pd

#Germany1 52.17365048266471, 10.50326921341822
#Germany2 52.17428145858134, 10.50385051351152

lines_kml = simplekml.Kml()
lines = lines_kml.newlinestring(name=‘Path’,
description=‘Germany1 to Germany2’,

#change the line width and color = 5 =

Lines_kml_path = ‘/Users/alkon/PycharmProjects/Lines_kml.kml’

#open with Google Earth pro[‘open’, lines_kml_path]);