开发者

Google Maps label a marker with KML

I was wondering, say I've got a KML file of points at locations. When I upload the KML and direct google maps to the file, it will show the points.

Now is is possible in the KML file to label that point, Just like Google Maps does when I search for airports or plumb开发者_开发知识库ers? Example like this: http://localhostr.com/files/boNhHEB/capture.png I want to do the markers with Numbers instead of letters.

Is this possible just using KML? or would I have to script this?


Yes you can using styles and adding a <styleurl> to each placemark

See: http://code.google.com/intl/nl-NL/apis/kml/documentation/kml_tut.html#custom_styles or http://econym.org.uk/gmap/kml.htm

If you want to show a number in each placemark you will however have to create a custom image (and style) for each one.


The link you reported (http://code.google.com/intl/nl-NL/apis/kml/documentation/kml_tut.html#custom_styles) describes the usage of style to specifiy a placemark at a specific location represented using an image. For example:

<Style id="highlightPlacemark">
    <IconStyle>
        <Icon>
            <href>http://maps.google.com/mapfiles/kml/paddle/red-stars.png</href>
        </Icon>
    </IconStyle>
</Style>

here there is specified only the .png image that must be used to represent the placemark. What about the label text? What are the tags do define a text? And how to use it?

Another question: what if I would like to add text in my kml not inside a baloon placemark but freely in a zone without a placemarker with an icon?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜