I have a matlab figure that I want to convert to a kml/kmz and cant seem to figure it out, I currently have a .csv where I use I sorted each point to a hex value, I just can't convert it to a kml/kmz for the life of me.
This is what ive tried to do so far,
import pandas as pd
import simplekml
def create_kml(data):
kml = simplekml.Kml()
for _, row in data.iterrows():
latitude, longitude, altitude, rsrp, color_hex = row
point = kml.newpoint(name=f'RSRP: {rsrp}', coords=[(longitude, latitude, altitude)])
point.style.iconstyle.color = simplekml.Color.changealphaint(255, color_hex)
point.style.iconstyle.scale = 1.0
return kml
def write_kmz(kml, output_file):
kml.savekmz(output_file)
if __name__ == "__main__":
# Load data from CSV
csv_file = "C:/Users/djtil/Desktop/EE598/all_data.csv"
data = pd.read_csv(csv_file)
# Output KMZ file
output_file = "output.kmz"
# Create KML object
kml = create_kml(data)
# Write to KMZ file
write_kmz(kml, output_file)
print(f"KMZ file '{output_file}' created successfully.")
CSV File https://drive.google.com/file/d/1Fm51NNlxdb5wCYTr8Zg9dZfx9__l6YGt/view?usp=sharing
Three issues are happening here:
Note setting the name in placemark clutters the map so set the name to the description.
Here's the data displayed in Google Earth Pro which matches the matlab image with green and orange colors at top and reds at the bottom.