许可优化
许可优化
产品
产品
解决方案
解决方案
服务支持
服务支持
关于
关于
软件库
当前位置:服务支持 >  软件文章 >  对esriSpatialRelEnum理解的常见误区

对esriSpatialRelEnum理解的常见误区

阅读数 109
点赞 0
article_banner

IFeatureSelection.SelectFeatures

官方解释:Selects features based upon the specifed criteria and combination method.

译文:根据指定的 标准 和组合方法选择要素。

有人这样解释:已知一个要素图层和我们的选择条件,寻找出符合要求的要素并闪烁显示

指定的标准,即为ISpatialFilter,那我们要考虑ISpatialFilter.Geometry的属性会对结果产生什么影响?

这个Geometry是否应该是合并一整个图层的要素,还是单独来一个一个判定?

如果按照上面的解释,应该是单独判定。

即为:不断改变ISpatialFilter.Geometry,进而改变ISpatialFilter

问题:对esriSpatialRelEnum的理解有问题

esriSpatialRelWithin       Description: Query Geometry is Within Target Geometry.

译文:within 查询 包含在目标Geometry内的Geometry。

Remarks:Returns a feature if its shape wholly contains the search geometry. Valid for all shape type combinations .

译文:返回一个要素,它的形状包含了这个搜索使用的Geometry。

这里Description与Remarks产生了分歧,或者我的理解出了问题。

但测试结果符合Remarks的解释。

  1. //根据要查询的坐标构造一个点
  2. IPoint targetPoint = new PointClass();
  3. targetPoint.PutCoords(x, y);
  4. //构造空间过滤器
  5. ISpatialFilter spatialFilter = new SpatialFilterClass();
  6. spatialFilter.Geometry = targetPoint;
  7. spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelWithin;//查询的是包含关系
  8. //在要素类上用空间过滤器进行查询即可
  9. IFeatureCursor cursor = riverGridFeatureClass.Search(spatialFilter, false);

由以上 代码 可以看出:Within查询的是包含SpatialFilter.Geometry的Geometry。

这也就意味着,如果你用 AE 来写ArcMap中的空间查找,其中的

contain the source layer feature 即:目标要素包含源图层要素选项

对应的过滤关系为

 pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelWithin;

are within the source layer feature 即:目标要素被源图层要素包含选项

对应的过滤关系为

 pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

注意contain对应的Within、within对应的Contains


免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删


相关文章
技术文档
QR Code
微信扫一扫,欢迎咨询~
customer

online

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 board-phone 155-2731-8020
close1
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

姓名不为空

姓名不为空
手机不正确

手机不正确

手机不正确
公司不为空

公司不为空

公司不为空