I created a vector layer to display labels. The layer shows up in the
"Overlays" legend and the points with the proper color show on the map.
No labels are visible but an alert() in the code shows that each point has a
valid label attribute.
What am I missing?
Thanks,
Joe
//###################################
function createLabelVectorLayer(theLayerName) {
theLabelVectors = new OpenLayers.Layer.Vector( theLayerName,
{
styleMap: new OpenLayers.StyleMap(
{
strokeColor: "${fill_color}",
strokeOpacity: 0.9,
strokeWidth: 3,
fillColor: "${fill_color}",
fillOpacity: 0.9,
pointRadius: 3,
pointerEvents: "visiblePainted",
fontColor: "red",
fontWeight: "bold",
label: "${label}"
}
)
});
map.addLayer(theLabelVectors);
}
processResponseText(prod) {
for (var ii=0; ii<prod.features.length; ii++) {
site_name = prod.features[ii].properties.site_name;
site_type = prod.features[ii].properties.site_type;
material = prod.features[ii].properties.bm_material;
/* Get the geometry x, y. */
fPoint = prod.features[ii].geometry['coordinates'];
x = fPoint[0].toString();
y = fPoint[1].toString();
the_geom = new OpenLayers.Geometry.Point(x, y);
if(site_type=="User") fill = "Green";
else fill = "Orange";
theLabel = site_name+", "+material;
features[ii] = new OpenLayers.Feature.Vector(the_geom);
features[ii].attributes = { "label": theLabel, "fill_color": fill };
}
}
--
View this message in context:
http://n2.nabble.com/Labels-not-showing-tp4933025p4933025.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users