<visibility> tag for folders

1,935 views
Skip to first unread message

Mike Callahan

unread,
Nov 22, 2008, 10:03:00 AM11/22/08
to KML Developer Support - Getting Started with KML
I don't understand the visibility tag for folders. Please explain what
am I doing wrong with this code:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>test</name>
<Folder>
<name>Visible</name>
<visibility>1</visibility>
<Placemark>
<name>A</name>
<Point>
<coordinates>-86.114,37.956,655.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>B</name>
<Point>
<coordinates>-86.334,37.895,570.0</coordinates>
</Point>
</Placemark>
</Folder>
<Folder>
<name>Hidden</name>
<visibility>0</visibility>
<Placemark>
<name>C</name>
<Point>
<coordinates>-86.514,37.756,655.0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>D</name>
<Point>
<coordinates>-86.734,37.695,570.0</coordinates>
</Point>
</Placemark>
</Folder>
</Document>
</kml>

On startup, I want the "Visible" folder visible but the "Hidden"
folder hidden. I see both even though the <visibility> tag for the
Hidden folder is set to 0. Thanks.


Bocha10

unread,
Nov 22, 2008, 4:28:29 PM11/22/08
to KML Developer Support - Getting Started with KML
KML and KMZ files can be displayed on both Google Earth and Google
Maps, and there is differences in the support of kml elements between
them
http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html
You did not specify were you have the problem, so I am going to make
general comments.

The visibility tag refers to the display of objects on the viewer, the
folder themselves are not visible or hidden rather their contents are.
Assuming that you are referring to the visibility of markers C and D,
you need to include the <visibility> tag in each placemark for them
not to be displayed in the viewer at startup.
http://code.google.com/apis/kml/documentation/kmlreference.html#visibility
This works as intended in Google Earth.

Unfortunately, the <visibility> tag is not fully supported in Google
Maps, and in my opinion may not be supported at all because in all my
experimentation the markers are always visible regardless of the value
of the <visibility> tag.

Mike Callahan

unread,
Nov 25, 2008, 7:55:25 AM11/25/08
to KML Developer Support - Getting Started with KML
Actually, the problem I was having is with Google Earth. In the above
code, even though the visibility tag was set to 0 for the folder, I
see both C and D. I guess the visibility tag does not work for
folders. I will add code to change visibility to every placemark.
However, I think that if I set visbility for a container to 0, then
all the elements under it should also be 0. I think this is a bug, but
the workaround is easy enough. Thanks for the response.

On Nov 22, 4:28 pm, Bocha10 wrote:
> KML and KMZ files can be displayed on both Google Earth and Google
> Maps, and there is differences in the support of kml elements between
> themhttp://code.google.com/apis/kml/documentation/kmlelementsinmaps.html
> You did not specify were you have the problem, so I am going to make
> general comments.
>
> The visibility tag refers to the display of objects on the viewer, the
> folder themselves are not visible or hidden rather their contents are.
> Assuming that you are referring to the visibility of markers C and D,
> you need to include the <visibility> tag in each placemark for them
> not to be displayed in the viewer at startup.http://code.google.com/apis/kml/documentation/kmlreference.html#visib...

Bocha10

unread,
Nov 25, 2008, 10:15:29 AM11/25/08
to KML Developer Support - Getting Started with KML
Styles in the current version of kml does not cascade down like css
styles do.
Hopefully it will be included in a future release.
You can help by supporting this request in the KML feature request
page.
http://code.google.com/p/kml-samples/issues/detail?id=1
You can "Star" this page and it will count as a vote for his issue.

Roman N

unread,
Nov 25, 2008, 2:54:40 PM11/25/08
to KML Developer Support - Getting Started with KML
Hi Mike,

That's a known bug in Earth. Our engineers are working on it. I've
filed a public issue at:

http://code.google.com/p/kml-samples/issues/detail?id=209

- Roman
Reply all
Reply to author
Forward
0 new messages