Skip to content

Panagiotis-Sklidas/KMLDataExtractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KMLDataExtractor

KML data extractor

CodeFactor

Contents

About the Project

This project was created during my studies at the University for the course "Optimization Algorithms". The final assignment required us to use optimization algorithms to find a solution to a similar postman problem with coordinates from a KML file. This Python script can export the placemarks' names and coordinates (latitude and longitude) to a CSV file as well as convert the latitude and longitude to x, y, and z coordinates, creating a second CSV file with them.

Features

  • Exports a CSV file named rawcoordinates, which has all placemarks' name and their latitude, longitude, and altitude coordinates
  • Exports a CSV file named coordinates, which has all placemarks names, their x, y, and z coordinates

Getting Started

Prerequisites

To run the application locally, you should have the following installed:

  • Python 3.9.6 (Download here)
  • defusedxml module
pip install defusedxml

Usage

  1. Download the Python file (extractData.py) and add it to the folder where your KML file is (or not)
  2. In your terminal window, move to where you downloaded the extractData.py
  3. Then run the following command:
python extractData.py "example.kml"   
  1. The script will extract and create the CSV files with the latitude and longitude and x,y,z coordinates.

Notes!

  • To add full fillpath, for example,e if the KML file is on your Desktop, the command should look like this:
python extractData.py "C:\Users\User\Desktop\example.kml"
  • The CSV files will be located in the same folder as the extractData.py file
  • The default namespace is: http://www.opengis.net/kml/2.2, but if you want to use another, then you can use the -n/--namespace flag. The command with -n flag looks like this:
python extractData.py "C:\Users\User\Desktop\example.kml" -n "http://www.opengis.net/kml/2.2"

License

See LICENSE

Acknowledgements

SUBJECT AREA: Optimization Algorithms
KEYWORDS: Python, KML, Data extraction, Transform coordinates to xyz

About

A kml data extraction script. Creates two csv: 1) with the placemaker's name and the latitude, longitude coordinates and 2) with the placemaker's name and the x,y,z coordinates.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages