Image Overlays on Google Earth with KML Files [message #81876] |
Tue, 30 October 2012 15:36  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I don't get really excited about IDL too much these days.
Except, of course, when a new release comes out, but those
moments are fleeting and almost immediately followed by
disappointment, so maybe they don't count.
I'm excited today, though.
Someone asked a week or so ago about creating KML files
from IDL, so that they could display them on Goggle Earth.
When I read the request I immediately realized how such a
capability would be valuable for the work I am doing, too.
So, I have been thinking about it ever since.
KML files are hierarchtical, so I immediately thought
about an object hierarchy approach. Over the weekend,
I started to put some of this object framework together.
There is a LOT more work to do, but I built just enough
to be able to create ground overlays from images in IDL.
Such images are draped onto the terrain map in Google Earth.
The exciting thing to me (as always!) is how nicely the
Coyote Graphics routines just lend themselves to doing
the next, new thing. It's like magic sometimes. But small
tweaks to the Coyote map routines to return map boundaries
in Goggle Earth preferred formats, and a new routine to
warp images in other map projections to the Google Earth
map projection (otherwise images won't align with Google
Earth continental boundaries, etc.) was almost too easy.
I also wrote a cgImage2KML program so those of you
terrified of objects can just ignore the darn things.
Who cares what's going on under the hood! :-)
The cgImage2KML program can use image variables, etc.
But, most of my images are in GeoTiff files, so the
routine is written to gather information from the
GeoTiff file directly. If you want to try this out,
you can use the AVHRR NDVI image from my web page.
You can find it here:
http://www.idlcoyote.com/data/AF03sep15b.n16-VIg.tif
Here is how you create a KML file with it. I'm using
a color table and displaying the image with 50%
transparency. The KML file will be named avhrr_ndvi.kml.
cgImage2KML, GeoTiff='AF03sep15b.n16-VIg.tif', Min_Value=0, $
CTIndex=11, /Brewer, /Reverse, Transparent=50, $
Filename='avhrr_ndvi.kml', $
Description='AVHRR NDVI Data from Africa'
Once the file is created, simply start Google Earth and open
the file. I haven't implemented a "goto" capability yet,
so you will have to rotate the Earth to see Africa, probably.
But, I'll have this fixed by tomorrow, no doubt.
Did you ever see anything more beautiful!? And perfectly aligned!
Wow! Blows me away.
You will need new files:
http://www.idlcoyote.com/programs/zip_files/coyoteprograms.z ip
I have LOTS of ideas for more functionality. If you have ideas of your
own, let me know. Check back often because I am sure there are bugs
and I know there will be many, many changes as I start to use these
programs at work.
Documentation for all these routines is available on-line:
http://www.idlcoyote.com/idldoc/cg/index.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
|
|
|
|
|
|
|
|
Re: Image Overlays on Google Earth with KML Files [message #82093 is a reply to message #81876] |
Wed, 14 November 2012 07:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Sverre Solberg writes:
> This will be a very valuable tool if it works out. However, I have a
> basic question about this. How do you import the data into Google
> Earth? Well, from the description I see that I should just use
> 'open file' and then import the klm file. But that doesnt work
> for me. I'm confused about the two files (klm and png). Are
> the klm file referring to the png in some way?
The klm and png file will need to be in the same directory
when you open the KLM file in Goggle Earth. Yes, the KLM
file is referring to the PNG file.
> It just displays the area with a red frame and a cross inside.
Yes, this is what happens when the image file can't be found.
> I have imported other klm files into Google E. and that works
> perfectly ok with just one file, no additional jpg/png etc.
> I'm probably missing some very basic stuff here ...
You probably opened a KMZ file. This is a zip file containing
the klm file and any other files the KLM file references. I
plan to add the ability to create KMZ files soon, but I
haven't figured out how to access the zip functionality
in a general way on different machines yet.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: Image Overlays on Google Earth with KML Files [message #82094 is a reply to message #81936] |
Wed, 14 November 2012 07:35  |
Sverre Solberg
Messages: 18 Registered: February 2005
|
Junior Member |
|
|
This will be a very valuable tool if it works out. However, I have a basic question about this. How do you import the data into Google Earth?
Well, from the description I see that I should just use 'open file' and then import the klm file. But that doesnt work for me. It just displays the area with a red frame and a cross inside. I'm confused about the two files (klm and png). Are the klm file referring to the png in some way? I have imported other klm files into Google E. and that works perfectly ok with just one file, no additional jpg/png etc. I'm probably missing some very basic stuff here ...
|
|
|