目录
1. ISpatialFilter接口简介
2 属性与方法
2.1 概述表
2.2 ISpatialFilter.SpatialRelDescription
2.3 ISpatialFilter.SpatialRel
2.4 IQueryFilter.WhereClause Property
2.5 其他属性
3 空间关系描述优秀论文
ISpatialFilter是一个包含空间和属性限制的QueryFilter,可以使用该过滤器进行要素的空间属性筛选:
AddField | Appends a single field name to the list of sub-fields. |
FilterOwnsGeometry | Indicates whether the filter owns the query geometry. |
Geometry | The query geometry used to filter results. |
GeometryEx | The query geometry used to filter results. |
GeometryField | The name of the Geometry field to which the filter applies. |
OutputSpatialReference | The spatial reference in which to output geometry for a given field. |
SearchOrder | The search order used by the filter.【This property only affects ArcSDE Geodatabase data. It has no effect on Personal or File Geodatabase, Coverage or Shapefile data.】 |
SpatialRel | The spatial relationship checked by the filter. |
SpatialRelDescription | The array elements which describe the spatial relation between the query geometry and the requested geometries. There are 9 chars in this string which can be either 'F', 'T' or '*'; e.g., TT*FFT***' represents CONTAIN. |
SubFields | The comma delimited list of field names for the filter. |
WhereClause | The where clause for the filter. |
public stringSpatialRelDescription {get; set;}
用来表述查询要素和对比要素的空间关系的数组,使用9个字符进行空间关系描述,使用该参数要求SpatialRel属性取枚举值esriSpatialRelRelation.它允许比较两个几何图形之间存在的任何空间关系, 空间关系由查询几何图形的边界、内部和外部与对比图形的交点确定。A spatial relationship is defined by the intersections between the boundary, interior, and exterior of the query geometry and the requested geometry.所有被esriSpatialRelEnum定义的关系,都可以由该属性计算得到。
描述空间关系的三个基本概念:
注意两个图形的外部是相交的
Each element for the first shape, the query geometry, may be tested against each element of the second shape, the requested geometry, giving nine possible spatial intersections as listed in the table below:
Query Geometry | Requested Geometry | 关系描述 | 备注 | |
---|---|---|---|---|
1 | interior | interior | 内-内 | 在查询图形和对比图形的内部 |
2 | interior | boundary | 内-边 | 在查询图形的内部,但在对比图型的边界上 |
3 | interior | exterior | 内-外 | 在查询图形的内部,但在对比图形的外部 |
4 | boundary | interior | 边-内 | 在查询图形的外部,但在对比图形的内部 |
5 | boundary | boundary | 边-边 | 在查询图形的边界上,但在对比图形的边界上 |
6 | boundary | exterior | 边-外 | 在查询图形的边界上,但在对比图形的外部 |
7 | exterior | interior | 外-内 | 在查询图形的外部,但在对比图形的内部 |
8 | exterior | boundary | 外-边 | 在查询图形的外部,但在对比图形的边界上 |
9 | exterior | exterior | 外-外 | 在查询图形的外部,但在对比图形的外部 |
说明: in 'FFFTTT***', relationships 1-3 must be false, relationships 4-6 must be true, and relationships 7-9 are not tested.
组合示例:
与esriSpatialRelEnum含义对应的字符串
[Approximate esriSpatialRelEnum SpatialRelDescription Strings ]
Relation | Query Geometry | Requested Geometry | String |
Contains | Line | Line | TT*FFT*** |
Contains | Point | Line | TT*FFT*** |
Contains | Point | Point | T******** |
Contains | Line | Poly | TT*FFT*** |
Contains | Poly | Poly | TT*FFT*** |
Crosses | Line | Line | TF*FF**** |
Crosses | Poly | Line | TT**F**** |
Crosses | Line | Poly | TT**T**** |
Overlaps | Line | Line | TT*T***** |
Overlaps | Point | Point | T******** |
Overlaps | Poly | Poly | TT*T***** |
Touch | Line | Line | FF*FT**** |
Touch | Poly | Line | FF*FT**** |
Touch | Line | Poly | FF*FT**** |
Touch | Poly | Poly | FF*FT**** |
Within | Line | Line | TF**F**** |
Within | Point | Line | T******** |
Within | Point | Point | T******** |
Within | Line | Poly | TF**F**** |
Within | Poly | Poly | TF**F**** |
[C#]public esriSpatialRelEnumSpatialRel {get; set;}
说明:
Most spatial relationships are defined by the intersection of boundaries, interior and exterior. All shapes have an interior. Lines and polygons have a boundary. Most spatial relations use a tolerance when examining the spatial relationship between two features. In most cases this tolerance is the XY tolerance of the search feature. All geometries within the tolerance are seen as intersecting. In the overlaps case the tolerance sets the minimum overlap. Geometries that overlap less than the tolerance will not be seen as overlapping.
该属性允许指定一个表达式,其实就是一个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.
关于字段名:
关于字符串:
通配符的使用:
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.
比较数字: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
[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;}
[C#] public IGeometryGeometry {get; set;}
[C#] public void set_GeometryEx ( IGeometryGeometry, boolA_2);
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);