I am trying to create a kml file in python (using simplekml) that has both points and lines that connect these points. I also want to make the points into squares instead of the default yellow pushpin.
Now i have successfully created kml files that have either points OR lines. But i want to combine the two together into one file. I am reading the files from a csv file. So i thought just putting the two codes together would give me a line and a point, but it did not. I just see points. What am i missing here?
inputfile = csv.reader(open(file, 'r'))
kml = simplekml.Kml()
ls = kml.newlinestring(name='A LineString')
ls.coords = np.array([[float(row[2]),float(row[1])] for row in inputfile ])
ls.extrude = 1
ls.altitudemode = simplekml.AltitudeMode.relativetoground
for row in inputfile:
kml.newpoint(name=row[0], coords=[(row[2], row[1])])
pnt.style.iconstyle.icon.href = 'http://maps.google.com/mapfiles/kml/shapes/placemark_square.png'
kml.save("Points_and_Line.kml")