This script converts a shapefile to a KML (Keyhole Markup Language) file. It utilizes the geopandas
and simplekml
libraries to read the shapefile and create the corresponding KML file.
- Install the required dependencies by running the following command:
pip install -r requirements.txt
- Run the script using the following command:
python convert.py --shapefile <path_to_shapefile> --kmlfile <output_kml_path>
Replace <path_to_shapefile>
with the path to the input shapefile you want to convert, and <output_kml_path>
with the desired path and filename for the output KML file.
--shapefile
: Path to the input shapefile (required).--kmlfile
: Path to the output KML file (optional). If not provided, the script will save the output KML file asoutput.kml
in the current directory.
To convert a shapefile named input.shp
to a KML file named output.kml
, run the following command:
Replace <path_to_shapefile>
with the path to the input shapefile you want to convert, and <output_kml_path>
with the desired path and filename for the output KML file.
--shapefile
: Path to the input shapefile (required).--kmlfile
: Path to the output KML file (optional). If not provided, the script will save the output KML file asoutput.kml
in the current directory.
-
Use Google Colab.
-
Open the
Convert_Shapefile_to_Kml.ipynb
notebook file in Colab. -
Replace the placeholder values with the path to the input shapefile and the desired output KML path.
-
Execute the notebook cells to convert the shapefile to KML. The resulting KML file will be saved at the specified output path.
This script is licensed under the MIT License. Feel free to customize the instructions and add any additional information as per your requirements.