Working code I have so far is below. Lots of airports on the map, you click an airport icon, the popup appears. No problems there.
Goal: to click a popup, and based on the lat/long data of that particular point, the map will center on that clicked point.
wfs.events.on({
featureselected: function(event) {
var feature = event.feature;
feature.popup = new OpenLayers.Popup.FramedCloud("box",
feature.geometry.getBounds().getCenterLonLat(),
null,
'<div>Airport: '+feature.attributes.Name +'<br> ICAO: '+feature.attributes.ICAO+'<br> IATA: '+feature.attributes.IATA+'</div>',
null,
true
);
while( map.popups.length ) {
map.removePopup( map.popups[0] );
}
map.addPopup(feature.popup);
}
});
Not sure how to go about this after browsing through other questions/looking at documentation. Also:
feature.geometry.getBounds().getCenterLonLat()
What exactly is the point of this?
Based on the docs it's for {OpenLayers.LonLat}
but it's not like it is reading the data from there?