{"id":15058860,"url":"https://github.com/danielcba/csv-to-kml","last_synced_at":"2025-03-15T22:43:25.431Z","repository":{"id":257793498,"uuid":"833916323","full_name":"danielcba/csv-to-kml","owner":"danielcba","description":"This Python script that converts a CSV file containing geographic coordinates (latitude and longitude) into a KML (Keyhole Markup Language) file. The KML file can be used with geographic visualization tools such as Google Earth, QGIS, etc.","archived":false,"fork":false,"pushed_at":"2024-10-30T03:00:06.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T11:47:34.739Z","etag":null,"topics":["csv","google-earth","kml","python3","qgis","simplekml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielcba.png","metadata":{"files":{"readme":"README-EN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-26T03:21:00.000Z","updated_at":"2024-10-30T03:00:09.000Z","dependencies_parsed_at":"2024-09-24T22:32:44.458Z","dependency_job_id":"df396dd1-b040-46b3-878d-adf7e6891067","html_url":"https://github.com/danielcba/csv-to-kml","commit_stats":null,"previous_names":["danielcba/csv-to-kml"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcba%2Fcsv-to-kml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcba%2Fcsv-to-kml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcba%2Fcsv-to-kml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielcba%2Fcsv-to-kml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielcba","download_url":"https://codeload.github.com/danielcba/csv-to-kml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801610,"owners_count":20350106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","google-earth","kml","python3","qgis","simplekml"],"created_at":"2024-09-24T22:31:49.562Z","updated_at":"2025-03-15T22:43:25.425Z","avatar_url":"https://github.com/danielcba.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSV to KML Converter\n\nThis Python script converts a CSV file containing geographic coordinates (latitude and longitude) into a KML file (Keyhole Markup Language). The KML file can be used with geographic visualization tools such as Google Earth, QGIS, etc.\n\n## Requirements\n\n- Python 3.x\n- `simplekml` library\n\nYou can install the `simplekml` library using pip:\n\n```sh\npip install simplekml\n```\n\n## Usage\n\n1. Prepare your CSV file with the following format:\n\n   ```csv\n   latitude,longitude\n   -31.518,-65.104\n   -31.548,-65.095\n   ```\n\n2. Save the CSV file in a known location on your system.\n\n3. An example file 'coordinates.csv' is attached.\n\n### Script: `csv_to_kml.py`\n\n```python\nimport csv\nimport simplekml\n\n# Create a KML object\nkml = simplekml.Kml(open=1)\n\n# Open the CSV file\nwith open('/my-folder/coordinates.csv') as csvfile:\n    reader = csv.DictReader(csvfile)  # Read the CSV file using a DictReader\n    \n    # Iterate through each row in the CSV\n    for row in reader:\n        lat, lon = (row['latitude'], row['longitude'])  # Get latitude and longitude from the row\n        pnt = kml.newpoint()  # Create a new point in the KML\n        pnt.coords = [(lon, lat)]  # Set the point's coordinates\n\n# Save the KML file\nkml.save(\"/my-folder/points.kml\")\n```\n\n### Run the Script\n\n1. Ensure that the script and the CSV file are in the specified directories.\n2. Run the script using Python:\n\n   ```sh\n   python csv_to_kml.py\n   ```\n\n3. The KML file will be created in the specified directory.\n\n### Notes\n\n- Make sure the CSV file path in the script matches the actual location of your CSV file.\n- The script assumes the CSV file contains columns named `latitude` and `longitude`.\n\n### Contributions\n\nContributions are welcome! Feel free to submit a Pull Request.\n\n### Contact\n\nIf you have any questions or suggestions, please open an issue or contact me.\n\n### License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcba%2Fcsv-to-kml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielcba%2Fcsv-to-kml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielcba%2Fcsv-to-kml/lists"}