Deh*_*tth 5 javascript jquery google-maps google-maps-api-3
我想在由以下代码片段绘制的多边形上放置带有信息的标签(或带有标签的 div)。样式属性已成功应用于要素(多边形类型)。有人知道如何向将显示在多边形中心的此功能添加文本吗?
function handleGeoJson(data) {
map.data.addGeoJson(data);
map.data.setStyle(function(feature) {
if (feature.getProperty('isColorful')) {
color = feature.getProperty('color');
}
return /** @type {google.maps.Data.StyleOptions} */( {
fillColor : color,
strokeColor : color,
strokeWeight : 1,
});
});
map.data.setStyle(featureStyle);
}
Run Code Online (Sandbox Code Playgroud)