基于C#的ArcEngine二次开发38: 几何关系描述接口- ISpatialFilter 最全解析(二)

本文涉及的产品
云解析 DNS,旗舰版 1个月
全局流量管理 GTM,标准版 1个月
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
简介: 基于C#的ArcEngine二次开发38: 几何关系描述接口- ISpatialFilter 最全解析

2.4 IQueryFilter.WhereClause Property


该属性允许指定一个表达式,其实就是一个sql语句,用来返回需要的要素;如你要获取面积大于1500的多边形,则应设置该参数为"AREA" > 1500;查询语法因使用的数据库而异,应用程序可以使用工作区上的ISQLSyntax接口来确定有关所用SQL语法的信息,例如限定表和字段名中使用的定界字符以及标识符引号字符。


The syntax of the query differs depending on the data source you are using, as it is in the native format of the database or data source.  An application can use the ISQLSyntax interface on a Workspace to determine information about the SQL syntax used, such as the delimiting character used in qualifying table and field names and the identifier quote character.


关于字段名:


如果查询数据是file geodatabase, shapefile, dBase table, coverage, INFO table,字段名应该使用双引号括起来,  "AREA"

如果查询的是个人数据库,应该使用中括号【square brackets】括起来 [AREA]

如果数据是 ArcSDE geodatabase、ArcIMS image service或feature service,不用括起来,  AREA

如果是.xls或.txt,字段使用单引号【single quotes】定义 'AREA' unless you are working in the Select By Attributes dialog launched from the table window, in which case square brackets [AREA] are used.

关于字符串:


字符串要使用单引号括起来:"STATE_NAME" = 'California'

使用转换函数处理数据库对字段值大小写敏感的情形:Personal geodatabases stored in Access are case insensitive to field values, whereas ArcSDE, File and shapefiles are case sensitive.  To make a case insensitive search in other data formats, you can use a SQL function to convert all values to the same case. For file-based data sources, use either the UPPER or LOWER function.

For example, given a field value of "Florida", a WhereClause of "State_name = 'florida'" will return one USA state when run against a data in a personal geodatabase, but none with and shapefiles and ArcSDE.  A WhereClause of "State_name = 'Florida'" will return one feature in all cases.

For example, the following expression will select customers whose last name is stored as either Jones or JONES: UPPER("LAST_NAME") = 'JONES'

Other data sources have similar functions. Personal geodatabases, for example, have functions named UCASE and LCASE that perform the same function.

使用LIKE运算符而非=运算符构架一个局部字符串搜索Use the LIKE operator (instead of the = operator) to build a partial string search.

For example, this expression would select Mississippi and Missouri among the USA state names:"STATE_NAME" LIKE 'Miss%'

如果对带=的字符串使用通配符,该字符将被视为字符串的一部分,而非通配符。If you use a wildcard character in a string with the = operator, the character is treated as part of the string, not as a wildcard.

通配符的使用:


代表一个或多个字符的记号

%表示该位置有任何位数的字符,可以是一个、100个或者没有;当你想搜索表示一个位置的通配符,_是备选方案。For any file-based data, '%' means that anything is acceptable in its place: one character, a hundred characters, or no character. Alternatively, if you want to search with a wildcard that represents one character, use '_'.

For example, this expression would select any name starting with the letters Cath, such as Cathy, Catherine, and Catherine Smith: "NAME" LIKE 'Cath%';使用%代替所有后边的字符

But this expression would find Catherine Smith and Katherine Smith:"OWNER_NAME" LIKE '_atherine smith';代替开头的一个字符

使用?表示任意数字字符,使用*表示单个字符:The wildcards you use to query personal geodatabases are '*' for any number of characters and '?' for one character.

Use ISQLSyntax::GetSpecialCharacter to return the wildcard specific for the data source being queried.【返回指定数据源特定的通配符】

对于链接表,使用与查询链接侧的通配符;查询仅面向目标侧,则使用目标侧通配符;查询仅面向链接表,则使用链接侧通配符;如果涉及两侧,则使用 % 和 \u 通配符。

For example, if you join a dbf file (the join table) to a personal geodatabase feature class (the target table):


1) Use * for queries that only involve personal geodatabase fields.


2) Use % for queries that only involve dbf columns.


3) Use % for queries involving columns from both sides of the table.


空值:Null values are supported in fields for geodatabases and for date fields in shapefiles/dBASE tables and coverages/INFO tables.

不等于:The Distinct keyword is not supported by file geodatabases.  The recommended workaround is to use the IDataStatistics::UniqueValues method to return the distinct values for a field.

比较数字:You can query numbers using the equal (=), not equal (<>), greater than (>), less than (<), greater than or equal (>=), and less than or equal (<=) operators.例如:"POPULATION96" >= 5000


查询日期:The syntax required for querying dates depends on the data type. ArcMap will automatically write the proper syntax for you when you double-click a date value in the Unique Values list. See the SQL reference mentioned above for more about querying dates.


关于SQL的参考网址:http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=SQL_reference


2.5 其他属性

[C#]public esriSearchOrderSearchOrder {get; set;}


请注意esriSearchOrderSpatial是默认属性,  以下esriSearchOrder枚举值用于设置搜索顺序:

esriSearchOrderAttribute:Sets the search order to attribute first.

esriSearchOrderSpatial:Sets the search order to spatial first.

[C#] public boolFilterOwnsGeometry {get;}
  • 过滤器是否属于查询图形
1. [C#] public IGeometryGeometry {get; set;}
2. [C#] public void set_GeometryEx ( IGeometryGeometry, boolA_2)

高级图形或图形包,如多边形、多段线、点、多点可以使用;低级图形,如路径、环、弧、曲线、线不能使用;

被IRelationalOperator接口实现的几何图形都支持,没有被其实现的都不支持。

The boolean parameter represents the FilterOwnsGeometry property.

Only high-level geometries, envelopes and geometry bags can be used. High-level geometries are polygons, polylines, points, and multipoints. Low-level geometries including paths, rings, arcs and curves, and lines can not be used. To test whether a geometry is applicable, see if it implements the IRelationalOperator interface; if it does, it can be used.

[C#] public stringGeometryField {get; set;}
  • 将用于滤波的几何图像字段名
[C#]public ISpatialReference get_OutputSpatialReference (stringFieldName);
[C#]public void set_OutputSpatialReference (stringFieldName, ISpatialReferenceOutputSpatialReference);
  • 为给定字段输出几何图形的空间参考。

3 空间关系描述优秀论文

2020050509444359.jpg

2020050509444386.jpg

20200505094443443.jpg

20200505094443796.jpg

20200505094444212.jpg


20200505094444646.jpg


20200505094445286.jpg

20200505094445286.jpg


相关文章
|
6天前
|
数据可视化 前端开发 测试技术
接口测试新选择:Postman替代方案全解析
在软件开发中,接口测试工具至关重要。Postman长期占据主导地位,但随着国产工具的崛起,越来越多开发者转向更适合中国市场的替代方案——Apifox。它不仅支持中英文切换、完全免费不限人数,还具备强大的可视化操作、自动生成文档和API调试功能,极大简化了开发流程。
|
25天前
|
存储 监控 算法
企业内网监控系统中基于哈希表的 C# 算法解析
在企业内网监控系统中,哈希表作为一种高效的数据结构,能够快速处理大量网络连接和用户操作记录,确保网络安全与效率。通过C#代码示例展示了如何使用哈希表存储和管理用户的登录时间、访问IP及操作行为等信息,实现快速的查找、插入和删除操作。哈希表的应用显著提升了系统的实时性和准确性,尽管存在哈希冲突等问题,但通过合理设计哈希函数和冲突解决策略,可以确保系统稳定运行,为企业提供有力的安全保障。
|
1月前
|
开发框架 监控 .NET
C#进阶-ASP.NET WebForms调用ASMX的WebService接口
通过本文的介绍,希望您能深入理解并掌握ASP.NET WebForms中调用ASMX WebService接口的方法和技巧,并在实际项目中灵活运用这些技术,提高开发效率和应用性能。
50 5
|
2月前
|
编译器 C# 开发者
C# 9.0 新特性解析
C# 9.0 是微软在2020年11月随.NET 5.0发布的重大更新,带来了一系列新特性和改进,如记录类型、初始化器增强、顶级语句、模式匹配增强、目标类型的新表达式、属性模式和空值处理操作符等,旨在提升开发效率和代码可读性。本文将详细介绍这些新特性,并提供代码示例和常见问题解答。
62 7
C# 9.0 新特性解析
|
2月前
|
C# 开发者
C# 10.0 新特性解析
C# 10.0 在性能、可读性和开发效率方面进行了多项增强。本文介绍了文件范围的命名空间、记录结构体、只读结构体、局部函数的递归优化、改进的模式匹配和 lambda 表达式等新特性,并通过代码示例帮助理解这些特性。
48 2
|
2月前
|
消息中间件 缓存 安全
Future与FutureTask源码解析,接口阻塞问题及解决方案
【11月更文挑战第5天】在Java开发中,多线程编程是提高系统并发性能和资源利用率的重要手段。然而,多线程编程也带来了诸如线程安全、死锁、接口阻塞等一系列复杂问题。本文将深度剖析多线程优化技巧、Future与FutureTask的源码、接口阻塞问题及解决方案,并通过具体业务场景和Java代码示例进行实战演示。
70 3
|
3月前
|
自动驾驶 安全 物联网
|
2月前
|
JSON 前端开发 JavaScript
API接口商品详情接口数据解析
商品详情接口通常用于提供特定商品的详细信息,这些信息比商品列表接口中的信息更加详细和全面。以下是一个示例的JSON数据格式,用于表示一个商品详情API接口的响应。这个示例假定API返回一个包含商品详细信息的对象。
|
2月前
|
C# 开发者
C# 一分钟浅谈:Code Contracts 与契约编程
【10月更文挑战第26天】本文介绍了 C# 中的 Code Contracts,这是一个强大的工具,用于通过契约编程增强代码的健壮性和可维护性。文章从基本概念入手,详细讲解了前置条件、后置条件和对象不变量的使用方法,并通过具体代码示例进行了说明。同时,文章还探讨了常见的问题和易错点,如忘记启用静态检查、过度依赖契约和性能影响,并提供了相应的解决建议。希望读者能通过本文更好地理解和应用 Code Contracts。
48 3
|
1月前
|
存储 安全 编译器
学懂C#编程:属性(Property)的概念定义及使用详解
通过深入理解和使用C#的属性,可以编写更清晰、简洁和高效的代码,为开发高质量的应用程序奠定基础。
94 12

推荐镜像

更多