[GIS] KML with text AND polygon

google mapskml

I'm working on applying some KML files to a google map on a mobile device, and have really been impressed with how easy everything is (so long as you stay inside the norm).

I have run into some trouble, however, in trying to display some text next to the polygon I define in the KML. I would rather not use any more libraries if at all possible.

In example I have seen the name attribute appear next to a marker, but not next to a polygon.

Thanks in advance for your time and please let me know if you want some more info!

Brad

Best Answer

Polygons are not labelled in KML, as a work-around add a point e.g. the centroid to the map. See also the KML Placemark reference:

a Point Placemark is the only object you can click or roll over. Other Geometry objects do not have an icon in the 3D viewer. To give the user something to click in the 3D viewer, you would need to create a MultiGeometry object that contains both a Point and the other Geometry object