Quantcast
Viewing all articles
Browse latest Browse all 14097

KML/KMZ in python

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.")

MatLab Figure

CSV Filehttps://drive.google.com/file/d/1Fm51NNlxdb5wCYTr8Zg9dZfx9__l6YGt/view?usp=sharing


Viewing all articles
Browse latest Browse all 14097

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>