Open Mon - Fri 09:00-17:00
Email [email protected] Call Now! +44(0)1689 602 248
Open Mon - Fri 09:00-17:00
Email [email protected] Call Now! +44(0)1689 602 248

Introducing pyKML – a Python library for manipulating KML

pyKML is an open source Python library for generating, parsing, and modifying KML, the geo-spatial data language used by Google Earth, Google Maps and a number of other GIS platforms.

I was motivated to create pyKML because I frequently need to visualize large, and often complex, environmental datasets. While the KML language has a wide range of options for styling, annotating and interacting with geo-spatial and temporal data, most programs that generate KML don’t take full advantage of these rich features. I created the pyKML library to address this problem by providing easy, programmatic access to all KML elements.

pyKML facilitates working with large and complex KML documents by leveraging the use of basic programming constructs (looping, branching, etc.). In this regard pyKML is similar to libkml, Google’s open source C++ library, but takes advantage of the highly readable syntax of the Python programming language and the processing capabilities of the popular lxml Python library.

As a simple example, check out this Python script that loops through a text string (“Hello World!”) and uses pyKML to create a series of KML Placemarks. You can download the resulting KML document, and below is a screenshot of how it looks in Google Earth.

This is just a teaser of what pyKML can do. For more complex examples, check out the pyKML documentation and the project’s Google Code site that includes sample code for: generating KML from CSV data, creating KML Tours, and visualizing ephermeris data for Stonehenge (e.g., orientation of the sun on different dates). pyKML can even be used to create “slides” for presentations!

To get started, browse the project’s documentation, install the library, try it out, and let us know what you think!

 

Python pyKML ‘How To’ Tutorial Videos

Python Custom KML Points, Lines, Polygons, Circles

Python Create Custom KML File Map Layers

Python Google Map Introduction | Creating Maps With gmap | Google Map

Parsing KML with Python

Learn NUMPY in 5 minutes – BEST Python Library!

All Top 40 Python Libraries EXPLAINED in 20 minutes

About the author

Blue Square Management are a web design and SEO Digital Marketing Agency based in Orpington and Bromley on the borders of South East London and Kent. We help businesses get more leads, increase sales and grow their businesses. Basically, Blue Square Management helps you get more phone calls and sell more products!We do by improving your search engine rankings and getting your found when people are looking for your products or services. We do this through online marketing, which includes SEO (Search Engine Optimisations), Local SEO, Web Design, PPC Management services, Online Reputation Management, Video Production Services, online Video Marketing and Social Media Marketing.Need help with your online marketing? Want more customers? Sell more products? Contact London & Kent's lead online digital marketing company, Blue Square Management to find out how we can help your business.