KML syntax allows for automatically placing a text label at the midpoint of a LineString, which requires the phrase
<gx:labelVisibility>1</gx:labelVisibility>
within the relevant <LineStyle> element.
however, there does not currently (simplekml v. 1.2.5) appear to be a way to set this gx:labelVisibility value in simplekml.
Example code fragment:
import simplekml
k = simplekml.Kml()
ls = k.newlinestring(name='My Line', coords=([(0,0),(1,1)]))
ls.style.linestyle.width=5
ls.style.linestyle.color=simplekml.Color.yellow
ls.style.labelstyle.scale=2
ls.style.labelstyle.color = simplekml.Color.blue
k.save('blah.kml')
Produces the KML
<?xml version="1.0" encoding="UTF-8"?>
<Document id="feat_1">
<Style id="stylesel_0">
<LabelStyle id="substyle_1">
<color>ffff0000</color>
<colorMode>normal</colorMode>
<scale>2</scale>
</LabelStyle>
<LineStyle id="substyle_0">
<color>ff00ffff</color>
<colorMode>normal</colorMode>
<width>5</width>
</LineStyle>
</Style>
<Placemark id="feat_2">
<name>My Line</name>
<styleUrl>#stylesel_0</styleUrl>
<LineString id="geom_0">
<coordinates>0,0,0.0 1,1,0.0</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
but if I add the line
<gx:labelVisibility>1</gx:labelVisibility>
within the
<LineStyle id="substyle_0"> tag, I see a label "My Line"
is it possible to add this gxlabelvisibility parameter in simplekml so that I don't have to hand-edit the KML files?
E.g. it would be
ls.style.labelstyle.gxlabelvisibility=1
Thanks.