I've been able to create a KML file that shows a circle on my (Google Earth) map. Now I would like to have a translucent fill on the circle. I'm new to KML, so I'm learning by trial-and-error with examples from the web.
My code looks like this:
EWR
EWR
1
-74.0733123604,40.6924798
-74.0753862256,40.7075157245
[...]
CLARIFICATION: I've gotten a few answers saying "adjust the value for the 'color' tag". That's enlightening, but doing that changes the opacity of the outline. What I want to do is fill the circle. I'm guessing that I need some additional tag(s) to do that.
Answer
For a point feature:
You'll basically need to define with a transparency prefix (see below). In your color tag referenced in your code above (ff0000ff ) the prefix ff represents 100% opaque or 0% transparent. To get to a 50% transparency, you'd need to use the hex representation of 7F as your prefix (7F0000ff) Hex Transparency Guide in Answers
From Google Earth Developers Forum:
Elements Specific to ColorStyle
Color and opacity (alpha) values are expressed in hexadecimal notation. The range of values for any one color is 0 to 255 (00 to ff). For alpha, 00 is fully transparent and ff is fully opaque. The order of expression is aabbggrr, where aa=alpha (00 to ff); bb=blue (00 to ff); gg=green (00 to ff); rr=red (00 to ff). For example, if you want to apply a blue color with 50 percent opacity to an overlay, you would specify the following: 7fff0000, where alpha=0x7f, blue=0xff, green=0x00, and red=0x00
An alternate work-around for creating a point with a transparent outline could be to create the image in GIMP or other photo-editing software where the .GIF has a transparent fill and opaque outline.
For a polygon feature:
You will need to create a style in order to use mixed transparencies. You need to use the PolyStyle tag to edit how the polygon is displayed. In the example below, fill and outline tags being set to "1" ensure visibility. ("0" would be false). The LineStyle tag is the outline, using the "FF" prefix, as above, you will see the line as solid. The Color Tag nested inside PolyStyle shows a 50% transparency, as expected with the 7F prefix.
Example taken from here.
No comments:
Post a Comment