GIS数据的查找方法

GIS数据的查找方法

2016-05-14 作者: zhangxiang 浏览: 3661 次

摘要: 利用FeaturCursor进行空间查询 //利用构造的Envelope(矩形框),查找和Envelope相交的FeatureClass的要素集 //结果数据利用循环FeatureCursor.nextFeature获得 IEnvelope envelope ...

利用FeaturCursor进行空间查询

//利用构造的Envelope(矩形框),查找和Envelope相交的FeatureClass的要素集

//结果数据利用循环FeatureCursor.nextFeature获得

IEnvelope envelope = new EnvelopeClass();

envelope.PutCoords(508786, 681196, 513033, 684341);

//空间查询

ISpatialFilter spatialFilter = new SpatialFilterClass();

spatialFilter.Geometry = envelope;

String shpFld = featureClass.ShapeFieldName;

spatialFilter.GeometryField = shpFld;

spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;//相交

IQueryFilter queryFilter = new QueryFilterClass();

queryFilter = (IQueryFilter)spatialFilter;

IFeatureCursor searchCursor = featureClass.Search(queryFilter, true);

IFeature feature = searchCursor.NextFeature();

int n = 0;

while (feature != null){

n++;

feature = baseCursor.NextFeature();

}

利用FeatureCursor在选择集中进行查询

IFeatureSelection pFeatureSelectio = pFeatureLayer as IFeatureSelection; 

ICursor ppCursor;

pFeatureSelectio.SelectionSet.Search(null, false, out ppCursor);

IFeatureCursor pFeatureCursor = ppCursor as IFeatureCursor; 

IFeature pFeature = pFeatureCursor.NextFeature();

利用FeatureCursor进行属性查询

IQueryFilter pQueryFilter = new QueryFilterClass();   

pQueryFilter.WhereClause = "PROJECTCODE = '" + this.ProjectNumTextBox.Text.Trim() + "'";

IFeatureCursor pFeatureCursor = LineFeaClass.Search(pQueryFilter, false);   

IFeature pFeatureIfExit = pFeatureCursor.NextFeature();

关注“开源集思”公众号
获取免费资源

随机推荐


Copyright © from 2014. 开源地理空间基金会中文分会 吉ICP备05002032号

Powered by TorCMS

OSGeo 中国中心 邮件列表

问题讨论 : 要订阅或者退订列表,请点击 订阅

发言 : 请写信给: osgeo-china@lists.osgeo.org