无法阅读财产' 0'未定义的6

时间:2016-06-09 14:24:11

标签: javascript



function obtainStatisticsProcess(){
    var wpsFormat= new OpenLayers.Format.WPSExecute();

    var doc= wpsFormat.write({
        identifier: "gs:RasterZonalStatistics", 
        dataInputs:[{
            identifier:'data',
            reference:{
                mimeType:"image/tiff",
                href: "http://geoserver/wcs",
                method: "POST",
                body: {
                    wcs: {
                        identifier:"projet_oncf:parcelles_lot1",
                        version:"1.1.1",
                        domainSubset: {
                            boundingBox: {
                                projection: "EPSG : 26191",
                                bounds: new OpenLayers.Bounds(200458.09375,286367.34375, 298056.46875,315811.96875 )
                            }
                            },
                        output: {format:'image/tiff'},
                        }
                        }
                        }
                        },
            {
                identifier:"zones",
                reference:{
                            mimeType:"text/xml; subtype=wfs-collection/1.0",
                            href: "http://geoserver/wfs",
                            method: 'POST',
                            body:{
                                wfs:{
                                    version:'1.0.0',
                                    outputFormat: "GML2",
                                    featureNS: "http://127.0.0.1:8082/geoserver/projet_oncf",
                                    featureType:'projet_oncf:parcelles_lot1',    
                                }
                            }
                        }
            }],

            responseForm:{
                    rawDataOutput:{
                        mimeType:"text/xml;subtype=wfs-collection/1.0",
                        identifier:"statistics"
                }
            }

            });


    OpenLayers.Request.POST({
        url:"http://127.0.0.1:8082/geoserver/ows",
        data:doc,
        headers: {
            "Content-Type": "text/xml;charset=utf-8"
        },
        success: function(response){
		//var response = [];
		//var features = [];
var res=response.responseText;
statisticsMessage="<p>The statistics for the selected area are:"+"<br>"+"<b>Minimum value:</b>"+res.features[0].properties["min"]+"<br>"+"<b>Maximum value:</b>"+res.features[0].properties["max"]+"<br>"+"<b>Average value:</b>"+roundNumber((res.features[0].properties["avg"]),2)+"</p>";
resultWindow= new Ext.Panel({
renderTo: "ResultsPanel",
html: statisticsMessage
});
resultWindow.show();
console.log(res.responseText);


            }
    });

}
&#13;
&#13;
&#13;

我做了这个函数来获取有关图层的统计信息,但当我点击按钮时,我应该给出结果我有这个错误无法读取属性&#39; 0&#39;未定义请帮助克服这个问题

0 个答案:

没有答案