GreyHippo
asked on
Problem creating Popup content for Openlayers
I have a map created using OpenLayers and now i am working to get a popup configured correctly. I have a feature attribute which contains a file name for a PDF. When the feature is clicked I would like to be able to create a link to the filename but I am having problem getting the link to work. Below is the content for the popup but it does not create the link:
"Owner: " + feature.attributes.OWNER + " <br> " + "<a href=" + feature.attributes.AB_PDF + ">"
"Owner: " + feature.attributes.OWNER + " <br> " + "<a href=" + feature.attributes.AB_PDF + ">"
ASKER
I am reading all my layers into the map via a remote JSON file and within the JSON file there are information for each layer such name, geojson url, stylemap, and information for a popup.
JSON file:
Below is the code for the popup:
I do not get any errors in the console. It just doesn't display the link.
JSON file:
{
"layers": [
{ "title":"FTMA San Pipe" , "url":"./ftma_sanpipe_3857.geojson" , "style": "layer.styleMap = sanpipe_stylemap;", "info" : "\"Owner: \" + feature.attributes.OWNER + \" <br> \" + \"<a href=\" + feature.attributes.AB_PDF + \">\""},
{ "title":"FTMA San MH" , "url":"./ftma_sanmh_3857.geojson" , "style" : "layer.styleMap = manhole_stylemap;", "info" : "\"Mh ID: \" + feature.attributes.STRUCT_ID"}
]
}
Below is the code for the popup:
function onFeatureSelect(evt) {
feature = evt.feature;
//console.log(feature);
//console.log(feature.layer.name);
console.log(feature.layer.popup_info);
popup = new OpenLayers.Popup.FramedCloud("featurePopup",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(200,200),
eval (feature.layer.popup_info),
null, true, onPopupClose);
feature.popup = popup;
popup.feature = feature;
map.addPopup(popup, true);
//alert ("select");
}
I do not get any errors in the console. It just doesn't display the link.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cd&