It took a fair bit of trial and error to coax a KML-friendly image out
of matplotlib and to understand what was and was not necessary. Below
is a demo script demonstrating how to accomplish a KML-friendly image
with and without a basemap. I hope this will help someone out.
What do I mean by a KML-friendly image? In KML you can overlay a
complicated geo-referenced image but it is geo-referenced based on the
boundaries of the image. So, for the image to be correctly displayed
in a KML document, the edges of the image have to be relatable to a
latitude or longitude. Most of the time this will mean you are using
Basemap and you'll need an image that encompasses only the bounding
box and nothing outside...no whitespace, extra room for titling, etc.
The below examples accomplish this. Turns out, the two key elements are
(1) ax = pyplot.axes((0,0,1,1))
and if you are using Basemap:
(2) a kwarg in Basemap: fix_aspect=False
Bruce W. Ford
Clear Science, Inc.
8241 Parkridge Circle N.
Jacksonville, FL 32211
Google Talk: fordbw@...287...