日期:2014-05-20  浏览次数:20690 次

ArcGIS Sever +C# 根据属性值定位
确定图层上的点的位置时运行程序出错
无法将类型为“ESRI.ArcGIS.ADF.Web.Geometry.Polygon”的对象强制转换为类“ESRI.ArcGIS.ADF.Web.Geometry.Point”。
具体程序如下所示,ArcGIS Sever10+VS2010
 ESRI.ArcGIS.ADF.Web.SpatialFilter spatialfilter=new ESRI.ArcGIS.ADF.Web.SpatialFilter();
                        spatialfilter.ReturnADFGeometries=true;
                        spatialfilter.MaxRecords=100;
                        spatialfilter.WhereClause="name  like '%"+eventtargs+"%'";

                        datatable=qfunc.Query(null,lids[selindex],spatialfilter);
                        if (datatable != null)
                        {
                            if (datatable.Rows.Count > 0)
                            {
                                for (int j = 0; j < datatable.Columns.Count; j++)
                                {
                                    if (datatable.Columns[j].DataType == typeof(ESRI.ArcGIS.ADF.Web.Geometry.Geometry))
                                    {
                                        ESRI.ArcGIS.ADF.Web.Geometry.Point pnt = (ESRI.ArcGIS.ADF.Web.Geometry.Point)datatable.Rows[0][1];
                                        Map1.CenterAt(pnt);
                                        m_ADFCallBackFunctionString = Map1.CallbackResults.ToString();
                                    }
                                }