博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ArcGIS Spatial Query
阅读量:7202 次
发布时间:2019-06-29

本文共 2466 字,大约阅读时间需要 8 分钟。

Creates a spatial query which performs a spatial search for features in the supplied feature class and has the option to also apply an attribute query via a where clause.

///Creates a spatial query which performs a spatial search for features in the supplied feature class and has the option to also apply an attribute query via a where clause.///  ///An ESRI.ArcGIS.Geodatabase.IFeatureClass///An ESRI.ArcGIS.Geometry.IGeometry (Only high-level geometries can be used)///An ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum (e.g., esriSpatialRelIntersects)///A System.String, (e.g., "city_name = 'Redlands'").///   ///
An IFeatureCursor holding the results of the query will be returned.
/// ///
Call the SpatialQuery method by passing in a reference to the Feature Class, a Geometry used for the search and the spatial operation to be preformed. An exmaple of a spatial opertaion would be intersects (e.g., esriSpatialRelEnum.esriSpatialRelContains). If you would like to return everything found by the spatial operation use "" for the where clause. Optionally a whereclause (e.g. "income > 1000") maybe applied if desired. The SQL syntax used to specify the where clause is the same as that of the underlying database holding the data.
public ESRI.ArcGIS.Geodatabase.IFeatureCursor PerformSpatialQuery(ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass, ESRI.ArcGIS.Geometry.IGeometry searchGeometry, ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum spatialRelation, System.String whereClause){ // create a spatial query filter ESRI.ArcGIS.Geodatabase.ISpatialFilter spatialFilter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass(); // specify the geometry to query with spatialFilter.Geometry = searchGeometry; // specify what the geometry field is called on the Feature Class that we will be querying against System.String nameOfShapeField = featureClass.ShapeFieldName; spatialFilter.GeometryField = nameOfShapeField; // specify the type of spatial operation to use spatialFilter.SpatialRel = spatialRelation; // create the where statement spatialFilter.WhereClause = whereClause; // perform the query and use a cursor to hold the results ESRI.ArcGIS.Geodatabase.IQueryFilter queryFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass(); queryFilter = (ESRI.ArcGIS.Geodatabase.IQueryFilter)spatialFilter; ESRI.ArcGIS.Geodatabase.IFeatureCursor featureCursor = featureClass.Search(queryFilter, false); return featureCursor;}

 

转载地址:http://mgwum.baihongyu.com/

你可能感兴趣的文章
VMware vSphere 5.0 五大改变
查看>>
spring注解性的事物@Transactional不起作用
查看>>
我的友情链接
查看>>
zookeeper常用使用场景
查看>>
高性能HTTP加速器Varnish(概念篇)
查看>>
使用aulayout自适应uitableviewcell高度
查看>>
selinux学习笔记
查看>>
pureftpd服务器的配置
查看>>
让我们一起Go(三)
查看>>
简单的Linux数据备份方案
查看>>
RIP协议和RIP2
查看>>
linux postgresql 安装配置详解
查看>>
一个监控tomcat运行的脚本分享
查看>>
电脑可以上网但网络连接显示感叹号
查看>>
我的友情链接
查看>>
MaxCompute用户初体验
查看>>
阿里云十年再出发,边缘计算已启航
查看>>
代理服务器与网络地址转换NAT
查看>>
Linux Shell 基本概念及编程(7)
查看>>
我的友情链接
查看>>