Google Maps label a marker with KML

折月煮酒 提交于 2019-12-24 08:59:13

问题


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 plumbers? 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?


回答1:


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.




回答2:


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?



来源:https://stackoverflow.com/questions/6733780/google-maps-label-a-marker-with-kml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!