我对openlayer和javascipt有一个探查。为什么cayxanh_getsource()
不被识别为函数?
function showPopup(evt){
var view = map.getView();
var coordinate = evt.coordinate;
var source = cay_xanh.getSource();
var url = source.getGetFeatureInfoUrl(evt.coordinate,
view.getResolution(), view.getProjection(), {'INFO_FORMAT':
'application/json', 'FEATURE_COUNT': 5});
if (url) {
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
success: function(data) {
console.log(data);
console.log(JSON.stringify(data));
var json = JSON.parse(JSON.stringify(data));
}
});
}//end if(url)
}//end ifelse