我在地图上显示标记时遇到了一个问题。我想在标记下方显示一些文字,但无论如何我都无法做到。这是我的示例代码中,我不知道我需要添加到其永久性地出现时标记显示如何显示标记下的文本
这是我的代码示例的一部分:
loop
htp.print('geocoder.getLatLng(');
htp.print(''''||r_klt.geoloc||''''||',');
htp.print('function(point) {');
htp.print('var baseIcon = new GIcon(G_DEFAULT_ICON);');
htp.print('baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png%22;');
--htp.print('baseIcon.shadow = "/i/pdf.png";');
htp.print('baseIcon.iconSize = new GSize(20, 34);');
htp.print('baseIcon.shadowSize = new GSize(37, 34);');
htp.print('baseIcon.iconAnchor = new GPoint(9, 34);');
htp.print('baseIcon.infoWindowAnchor = new GPoint(9, 2);');
htp.print('var letteredIcon = new GIcon(baseIcon);');
l_address := r_klt.geoloc;
htp.print('letteredIcon.image = "http://www.google.com/mapfiles/marker'%7C%7Cchr(65+l_t)%7C%7C'.png%22;');
htp.print('markerOptions = { icon:letteredIcon'};');
htp.print('var marker = new GMarker(point,markerOptions);');
htp.print('var html = "<h1>'||r_klt.geoloc||'</h1>";');
htp.print('GEvent.addListener(marker, "mouseover", function() { marker.openInfoWindowHtml(html); });');
htp.print('map.addOverlay(marker);');
htp.print('}');
htp.print(');');
l_t := l_t + 1;
end loop;
在现有示例的标记下面是否可以包含某些文本? – Dejan
我不这么认为,MarkerLabel对象是在版本3中引入的。也存在[MarkerWithLabel](https://github.com/googlemaps/v3-utility-library/tree/master/markerwithlabel)扩展名,但是我不确定它是否与JavaScript API的过时版本2兼容。 – xomena