I'm using the python library simplekml to make a .kml file that shows routes connecting airports with Points to show the airports and LineStrings to show possible flights. The generated .kml file shows up fine in the Google Earth website but on Google Earth Pro it cuts off depending on the zoom applied.
I have tried messing with the LineString attributes to see if I'm missing anything but nothing has worked so far. My code is the following:
for i in range(len(path)):
airport_coords = (
airports_df[airports_df['Code'] == path[i]]['Longitude'].values[0],
airports_df[airports_df['Code'] == path[i]]['Latitude'].values[0]
)
point = kml.newpoint(name=path[i], coords=[airport_coords])
point.style.iconstyle.icon.href = 'http://www.gstatic.com/mapspro/images/stock/1417-trans-airport.png'
point.style.iconstyle.scale = 3
if i > 0:
last_coords = (
airports_df[airports_df['Code'] == path[i-1]]['Longitude'].values[0],
airports_df[airports_df['Code'] == path[i-1]]['Latitude'].values[0]
)
line = kml.newlinestring(name='Line', coords=[last_coords, airport_coords])
line.style.linestyle.width = 3
line.style.linestyle.altitudemode = simplekml.AltitudeMode.clamptoground
line.style.linestyle.tessellate = 1
line.style.linestyle.color = simplekml.Color.red
As you can see, I increased the line width, set the altitude mode clamped to the ground, and set tessellate to 1.
As it turned out, tessellate
and altitudemode
aren't part of the styling of the line. Instead of:
line.style.linestyle.altitudemode = simplekml.AltitudeMode.clamptoground
line.style.linestyle.tessellate = 1
It should have been:
line.altitudemode = simplekml.AltitudeMode.clamptoground
line.tessellate = 1