Hi, Can GroundOverlay be transparent, how to do that?

1,399 views
Skip to first unread message

lei SHI

unread,
Nov 26, 2009, 10:49:16 PM11/26/09
to KML Developer Support - Google Earth Plug-in
var groundOverlay = ge.createGroundOverlay('');
groundOverlay.setIcon(ge.createIcon(''))
groundOverlay.getIcon().setHref("http://www.google.com/intl/en_ALL/
images/logo.gif");

Nymor

unread,
Nov 27, 2009, 5:10:29 AM11/27/09
to KML Developer Support - Google Earth Plug-in
Hi,

Yes GroundOverlays can be transparent - just make it so when you
create the gif/png - there's nothing in the API to do it it's a
property of the image itself. (I've only done it with .png files
myself but assume that gifs are fine too).

To add transparancy refer to the documentation for the graphics
package you use - Photoshop/GIMP etc.

Hope that helps
Nymor

Shea

unread,
Nov 29, 2009, 10:08:57 AM11/29/09
to KML Developer Support - Google Earth Plug-in
I find the best way to do this is by load the file in google earth
desktop first, once loaded, go to the table of contents, and click on
the plus sign next to the image, now you get two layers, right click
on the second layer, go to properties and then a menu pops up... drag
the transparency bar to desired transparency. Save it as a kml file.
But to be honest this is where i am stuck at the moment, once at this
point I myself am having trouble getting the kml to load properly in
the api correctly.
hoping this will get figured out in the next couple of days. Once I
figure it out I will post what to do next. I hope this helps a little
bit let me know if you have any questions

Shea

Nymor

unread,
Nov 29, 2009, 10:42:41 AM11/29/09
to KML Developer Support - Google Earth Plug-in
Ahh - might have misinterpreted the OP's question...

What I was referring to was setting parts of the image as transparent
- for example just showing a track/road or something like that - which
would be done in the image itself.

However if you want to actually change the opacity of the image
overlay, as you can do in the standalone GE application by dragging
the transparency bar, then there looks like there is a way to do that
in the GE Plugin.

I haven't tried this myself - don't have the need - but maybe this
will help you Shea...

Both ground and photo overlays are part of the KMLOverlay object
http://code.google.com/apis/earth/documentation/reference/interface_kml_overlay.html

..which has a getColor function.

Within that it seems you can specify 4 values using the Set function -
the last of which is "void KmlColor.setA(int a)" for the Alpha channel
(opacity) - see
http://code.google.com/apis/earth/documentation/reference/interface_kml_color.html

So it looks like there is a way and although as I say I haven't tried
it myself that's where I'd start.

Would be interested to know if that works out.

Regards
Nymor
Reply all
Reply to author
Forward
0 new messages