I am trying to overlay a kml file onto a ground overlay image in google maps for Android. The polygons are displayed properly but the names of the placemarks are not displayed, in their place there are bubbles instead which only display the name when clicked.
Here is an image of what android maps displays instead of the names that are rendered correctly on google earth screenshot of kml overlay
Here is a sample of the kml file
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<open>1</open>
<Style id="Style_5">
<IconStyle><scale>0</scale></IconStyle>
<LabelStyle><color>9900ffff</color><scale>1</scale></LabelStyle><LineStyle><color>990000ff</color><width>1.5</width></LineStyle><PolyStyle><color>997f7fff</color><fill>0</fill><outline>1</outline></PolyStyle>
</Style>
<Placemark id="pm1">
<name>
<![CDATA[Name of place]]>
</name>
<Snippet maxLines="0">empty</Snippet>
<styleUrl>#Style_5</styleUrl>
<MultiGeometry>
<Point id="g0">
<altitudeMode>clampToGround</altitudeMode>
<coordinates>37.3870283588389,3.89010909235333</coordinates>
</Point>
<MultiGeometry>
<Polygon id="g1">
<altitudeMode>clampToGround</altitudeMode>
<outerBoundaryIs>
<LinearRing>
<coordinates>37.488080789205128,4.004061832979036 37.493240913308938,3.932680116209725 37.490660851257033,3.907739516374665 37.486360747837196,3.893979185431183 37.478620561681488,3.884518957907539 37.281675825052908,3.776156351727622 37.284255887104806,3.783036517199363 37.288555990524642,3.789056661987136 37.290276031892581,3.799376910194747 37.300596280100194,3.80539705498252 37.298876238732255,3.815717303190131 37.303176342152092,3.826037551397743 37.304036362836065,3.839797882341224 37.311776548991773,3.852698192600738 37.3109165283078,3.865598502860252 37.309196486939868,3.878498813119766 37.309196486939868,3.902579392270859 37.316936673095576,3.933540136893693 37.323816838567318,3.950740550573045 37.321236776515413,3.967940964252397 37.280815804368935,3.989441481351587 37.294576135312418,4.002341791611101 37.488080789205128,4.004061832979036</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</MultiGeometry>
</MultiGeometry>
</Placemark>
</Document>
</kml>
The Maps APIs do not support all of the KML elements which Earth supports, and I believe that the icon and label options you want are among the un-supported elements. If I understand correctly, you want to have the KML file display on the map without icons (you've set IconStyle/scale to zero), and instead only display labels for each point (you have a LabelStyle set).
Looking at the documentation for KML in the Maps Javascript API, you can see that <scale>
is not supported so you can't make the icons zero size, and <LabelStyle>
is not supported at all. But I just realized that there is separate documentation for the Maps Android SDK, where it says that <scale>
is supported, so you should be able to adjust the icon size... but <LabelStyle>
is not supported, which probably means labels are not supported. Note that <IconStyle>
appears to be supported in both, but its child <color>
tag is supported in the Android SDK, but not the Javascript API.
You should be able to test the IconStyle > scale tag by trying a KML file with just simple points and a few icon scale options to see which work (zero may be a special case?). You can also try a simple Label without styling, to see if you can get labels to work at all, but I suspect they won't.