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!



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

  • I was afraid of that :) Thanks so much for your response! – Brad Apr 5 '12 at 13:50
  • 1
    You create a very small icon for the markers - the text will hide the small points and then the polygons 'seem' to have labels... – Mapperz Apr 5 '12 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.