Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active October 9, 2025 11:08
Show Gist options
  • Save aspose-com-gists/eb163a046a9dc0685ec4fc6591901abe to your computer and use it in GitHub Desktop.
Save aspose-com-gists/eb163a046a9dc0685ec4fc6591901abe to your computer and use it in GitHub Desktop.
Convert GPX to KML in Python
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