KML file appears with strange round symbols instead of labels

50 views
Skip to first unread message

Gareth

unread,
Jun 28, 2011, 3:04:45 PM6/28/11
to google-map...@googlegroups.com
I made a KML file out of a Shapefile in ESRI ArcMap, the labels are supposed to appear as text. When I load it into Google Earth, the labels appear exactly as they should. But when I try to add it into Google Maps using the JavaScript API, the labels instead appear as these ugly circular symbols. Why is this happening?
 
Here is a link to a page where this is happening:
 
 
And here is the link where you can download the KML file:
 
 

Rossko

unread,
Jun 28, 2011, 8:03:04 PM6/28/11
to Google Maps JavaScript API v3
> the labels instead appear as these ugly circular symbols.

Those are exactly what your KML asks for eg.

<Placemark>
<name><![CDATA[RO]]></name>
<styleUrl>#RO_LABELS</styleUrl>
<Point> ....

and if we look at the style

<Style id="RO_LABELS">
<IconStyle> ...
<href>http://maps.google.com/mapfiles/kml/shapes/
placemark_circle.png</href>

Perhaps the circles you request are hidden under the labels when
viewed in GE. So where are the labels in Maps?

> http://northmiamicra.org/KMLs/Zoning.kml

<LabelStyle> is not supported in KmlLayer I think
http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html

Gareth

unread,
Jun 29, 2011, 9:10:05 AM6/29/11
to Google Maps JavaScript API v3
Thanks for your reply. Having opened the KML file in notepad, I do now
see that it specifies those horrible circles, it is still strange that
they do not appear in Google Earth though.

So if Google Maps does not support <labelColor> and <LabelStyle>, how
does one label the features in a KML file within Google Maps? There
must be a way, unless Google has decided to supress this functionality
on purpose because they do not want to give away so much control in an
API they provide for free...

Does anybody have a KML file that succesfully displays labels in a
Google Map?

Rossko

unread,
Jun 29, 2011, 8:00:04 PM6/29/11
to Google Maps JavaScript API v3
> So if Google Maps does not support <labelColor> and <LabelStyle>, how
> does one label the features in a KML file within Google Maps? There
> must be a way, unless Google has decided to supress this functionality
> on purpose because they do not want to give away so much control in an
> API they provide for free...

No, they leave it up to you the developer. Maps supports only a
subset of KML, for instance altitude stuff is pretty meaningless on 2D
maps so there's little point in supporting that.
They have also left out other stuff too, like labels, but I think
you're being a bit paranoid about the reasons; Google Earth is a big
fat application, while Maps is intended to stay a simpler slimmer
beast more suitable for webpages and mobile use.

The API does allow the flexibility to code a whole bunch of stuff
above and beyond what can be encoded in KML, it would certainly be
possible to write bespoke code to extract info and create labels as
you wish. Example labels
http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.5/examples/infobox-label.html
buy in your case you'd have a lot more work to do to integrate that
with KML.
This kind of thing has been discussed before
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/d50517f9a4acbb68/eac1deaa835ce9b7
but I haven't seen any implementation yet.

Why aren't you using the GE API if you want full-featured KML on a
webpage ?
http://code.google.com/apis/earth/

Gareth

unread,
Jun 30, 2011, 10:02:02 AM6/30/11
to google-map...@googlegroups.com
Thanks again Rosko,
 
I have now in fact used the same infobox that you suggested to place my labels, by placing them in an xml file and reading them into seperate infoboxes.
However, now my problem is that they appear under my KML file and are thus difficult to see:
 
 
My labels are the little things that say "C3", "C1", etc. I would have prefered to have them appear on top of the KML file so that they would be easire to make out.
The strange thing is that I call the code to add the KML file before I call the code to put the infoboxes on the map, so i would have thought that it would add them in ontop afterwards. Is there anyway to modify my code to have them appear ontop?
Reply all
Reply to author
Forward
0 new messages