[OpenLayers-Users] Popup Box Problem using multiple layers

boesiii boesiii at yahoo.com
Thu Sep 12 13:31:57 PDT 2013


I will be creating many layers in my OpenLayers map so I am loading all
layers using a JSON file.  Each layer will have a different popup box which
will be specified with the JSON file {"popup" :
"feature.attributes.SOME_ATTRIBUTE_1 + feature.attributes.SOME_ATTRIBUTE_2"}
but the name of the attributes for each layer will be different.  How can I
store the custom popup information so that i can recall it easily when the
popup is created.

var  json = new  OpenLayers.Format.JSON ();
var  response = json.read (request.responseText);
var layer_data = response.layers

for (var i in layer_data) {
    var layer_popup = layer_data[i].popup;
    ....//some layer stuff
    layer_popup_array.push(layer_popup); 
}

function onFeatureSelect(evt) {
    feature = evt.feature;
    console.log(feature);
    console.log(feature.layer.name);
    popup = new OpenLayers.Popup.FramedCloud("featurePopup",
        feature.geometry.getBounds().getCenterLonLat(),
        new OpenLayers.Size(200,200),
        <<<<<<<<some procedure to recall custom layer popup>>>>>>>>,
        null, true, onPopupClose);
        ... //typical popup stuff
}





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Popup-Box-Problem-using-multiple-layers-tp5077608.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list