当前位置: 首页>>代码示例>>C#>>正文


C# QueryFilterClass.set_OutputSpatialReference方法代码示例

本文整理汇总了C#中QueryFilterClass.set_OutputSpatialReference方法的典型用法代码示例。如果您正苦于以下问题:C# QueryFilterClass.set_OutputSpatialReference方法的具体用法?C# QueryFilterClass.set_OutputSpatialReference怎么用?C# QueryFilterClass.set_OutputSpatialReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryFilterClass的用法示例。


在下文中一共展示了QueryFilterClass.set_OutputSpatialReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportCsvHandler

        private byte[] ExportCsvHandler(NameValueCollection boundVariables,
                                          JsonObject operationInput,
                                              string outputFormat,
                                              string requestProperties,
                                          out string responseProperties)
        {
            string retval = "";
            StringBuilder sb = new StringBuilder();
            string s = "";
            bool applyQuery = true;
            bool? applyHeader = true;
            //bool? applyGeoms = true;
            bool addHeader = false;
            //bool addGeoms = false;
            responseProperties = "{\"Content-Type\" : \"text/csv\"}";

            string whereClause = "";
            bool found = operationInput.TryGetString("query", out whereClause);
            if (!found || string.IsNullOrEmpty(whereClause))
            {
                //then no definition query
                applyQuery = false;
            }

            long? layerOrdinal;
            found = operationInput.TryGetAsLong("layer", out layerOrdinal); //.TryGetString("layer", out parm2Value);
            if (!found)
            {
                throw new ArgumentNullException("layer");
            }

            bool useHeader = operationInput.TryGetAsBoolean("headers", out applyHeader);
            if (useHeader)
            {
                if ((bool)applyHeader)
                {
                    addHeader = true;
                }
            }

            //bool useGeoms = operationInput.TryGetAsBoolean("addgeoms", out applyGeoms);
            //if (useGeoms)
            //{
            //    if ((bool)applyGeoms)
            //    {
            //        addGeoms = true;
            //    }
            //}

            ESRI.ArcGIS.Carto.IMapServer mapServer = (ESRI.ArcGIS.Carto.IMapServer)serverObjectHelper.ServerObject;
            ESRI.ArcGIS.Carto.IMapServerDataAccess mapServerObjects = (ESRI.ArcGIS.Carto.IMapServerDataAccess)mapServer;
            var lyr = mapServerObjects.GetDataSource(mapServer.DefaultMapName, Convert.ToInt32(layerOrdinal));
            if (lyr is IFeatureClass)
            {
                IFeatureClass fclass = (IFeatureClass)lyr;
                IQueryFilter filter = new QueryFilterClass();
                filter.set_OutputSpatialReference(fclass.ShapeFieldName, getWGS84());
                if (applyQuery)
                {
                    filter.WhereClause = whereClause;
                }
                IFeatureCursor curs = fclass.Search(filter, false);
                try
                {
                    //();
                    s = curs.ToCSV(addHeader);
                    Marshal.ReleaseComObject(curs);

                }
                catch (Exception ex)
                {
                    s = ex.GetBaseException().ToString(); //.StackTrace;
                }
                retval = s;
                sb.Append(retval);
            }
            else
            {
                throw new Exception("Layer " + layerOrdinal.ToString() + " is not a feature layer.");
            }

            return Encoding.UTF8.GetBytes(sb.ToString());
        }
开发者ID:flyingliang,项目名称:AGSOpenFormats,代码行数:83,代码来源:GeoJSONSOE.cs


注:本文中的QueryFilterClass.set_OutputSpatialReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。