Maps Platform
Product updates, customer stories, and tips and tricks on Google Maps Platform
Introducing pyKML - a Python library for manipulating KML
Wednesday, January 18, 2012
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
!
Posted by
Tyler Erickson
, Senior Research Scientist / Engineer,
MTRI
Labels
5 Great Maps
ads
advertising
africa
Andorra
Android
App Engine
art
Australia
Autocomplete
Boston
brazil
Bruce Springsteen
Bulgaria
Campus Map
Chrome
City 24/7
Code for America
COM API
Computerlogy
creative advertising campaigns
Custom Map Types
design
developer
Developer Challenge
Developer stories
Directions API
Drawing Tools
Driving Directions
Earth
Earth API
Elevation API
environment
epungo
Estonia
Europe
Fab Friday
flash
Fusion Tables
GAE
games
GDAL
Gears
geo
Geodesic Lines
Germany
Gibraltar
GIS
Global Economy
gme
Google Analytics
Google App Engine
Google Earth
Google Earth API
Google I/O
Google Maps
Google Maps API
Google Maps Engine
Google Places API
Google Places API Developer Challenge
Google Street View API
government
Hackathon
Hamburg
heat map
heatmap
hiking
Hungary
iOS
JavaScript
jQuery
kenya
KML
Latitude API
Latvia
launch
Lithuania
local search
London
Mac
Map of the Week
maps
Maps API
Maps API for Flash
Maps Data API
Maps Zen
Marker Clusterer
Marketing
Mars
meetup
mobile
moca
modern art
More Than a Map
Morethanamap
Movies
Neighborhoods
New York City
Office Hours
Olympics
Panoramio
photos
Place Summaries
Places API
Plus
polygons
Premier
public transit
public transit layer
Python
real estate
rock
sao paulo
screencast
SketchUp
Slovakia
Slovenia
South Africa
Spain
Spatial Data Files
Static Maps API
street view
Styled Maps
Sydney
Track
traffic layer
Transportation
Tripline
Twitter
UN
United Nations
V3
Vancouver Olympics
visualizations
Volkswagen
VW
web
youtube
Archive
2018
Nov
Jul
Jun
May
Mar
Feb
2017
Nov
Jun
May
Apr
Mar
Feb
Jan
2016
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Feb
2015
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2014
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
2013
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2012
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2011
Dec
Nov
Oct
Sep
Aug
Jul
May
Apr
Mar
Feb
Jan
2010
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2009
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2008
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Feed
Follow @GMapsPlatform
Follow
Google Maps Platform Website
Give us feedback in our
Product Forums
.