Last active
October 9, 2025 11:08
-
-
Save aspose-com-gists/eb163a046a9dc0685ec4fc6591901abe to your computer and use it in GitHub Desktop.
Convert GPX to KML in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import aspose.gis as gis | |
from aspose.gis import VectorLayer, Drivers | |
# Define the working directory and license path. | |
data_dir = "files" | |
license_path = "license.lic" | |
# Apply Aspose.GIS license | |
license = gis.License() | |
license.set_license(license_path) | |
# Set input GPX file and output KML file paths. | |
input_gpx_path = os.path.join(data_dir, "input.gpx") | |
output_kml_path = os.path.join(data_dir, "output.kml") | |
# Convert GPX to KML by calling the convert method. | |
VectorLayer.convert(input_gpx_path, Drivers.gpx, output_kml_path, Drivers.kml) | |
print(f"Successfully converted GPX to KML: {output_kml_path}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment