Skip to content

Commit

Permalink
Move the INTERSECTS operator from simple_cql to the spatial_operators
Browse files Browse the repository at this point in the history
conformance class (prevously know as enhanced_spatial_operators).
  • Loading branch information
pvretano committed Jun 13, 2021
1 parent ddfd401 commit 2bae926
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 145 deletions.
4 changes: 2 additions & 2 deletions extensions/cql/standard/clause_10_encodings.adoc
Expand Up @@ -83,7 +83,7 @@ include::requirements/cql-text/REQ_filter-lang.adoc[]

include::requirements/cql-text/REQ_simple-cql.adoc[]

include::requirements/cql-text/REQ_enhanced-spatial-operators.adoc[]
include::requirements/cql-text/REQ_spatial-operators.adoc[]

include::requirements/cql-text/REQ_temporal-operators.adoc[]

Expand All @@ -109,7 +109,7 @@ include::requirements/cql-json/REQ_filter-lang.adoc[]

include::requirements/cql-json/REQ_simple-cql.adoc[]

include::requirements/cql-json/REQ_enhanced-spatial-operators.adoc[]
include::requirements/cql-json/REQ_spatial-operators.adoc[]

include::requirements/cql-json/REQ_temporal-operators.adoc[]

Expand Down
15 changes: 5 additions & 10 deletions extensions/cql/standard/clause_2_conformance.adoc
Expand Up @@ -8,7 +8,7 @@ grouped by their standardization target:
** <<rc_features-filter,Features Filter>>
* Filter expressions
** <<rc_simple-cql,Simple CQL>>
** <<rc_enhanced-spatial-operators,Enhanced Spatial Operators>>
** <<rc_spatial-operators,Spatial Operators>>
** <<rc_temporal-operators,Temporal Operators>>
** <<rc_functions,Functions>>
** <<rc_arithmetic,Arithmetic expressions>>
Expand Down Expand Up @@ -61,22 +61,17 @@ The specific set of operators defined in this requirements class is:
** is null
** between
** in
* Spatial operators:
** s_intersects
An encoding of CQL may be used as the value of the filter parameters defined
in the <<rc_filter,Filter>> requirements class.

The <<rc_enhanced-spatial-operators,Enhanced Spatial Operators>> requirements
class specifies requirements for servers that support spatial operators in
addition to the `intersects` operator that is defined in the
<<simple-cql_spatial-predicates,Simple CQL>> requirements class. The list of
additional spatial operators that must be supported is:
The <<rc_spatial-operators,Spatial Operators>> requirements class specifies requirements for servers that support spatial operators. The list of additional spatial operators that must be supported is:

* s_contains
* s_crosses
* s_disjoint
* s_equals
* s_intersects
* s_overlaps
* s_touches
* s_within
Expand Down Expand Up @@ -143,7 +138,7 @@ OGC Compliance Testing web site.
|<<ats_filter,Filter>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/filter
|<<ats_features-filter,Features Filter>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/features-filter
|<<ats_simple-cql,Simple CQL>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/simple-cql
|<<ats_enhanced-spatial-operators,Enhanced Spatial Operators>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/enhanced-spatial-operators
|<<ats_spatial-operators,Spatial Operators>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/spatial-operators
|<<ats_temporal-operators,Temporal Operators>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/temporal-operators
|<<ats_functions,Functions>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/functions
|<<ats_arithmetic,Arithmetic>> |http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/arithmetic
Expand All @@ -161,7 +156,7 @@ following requirements classes:
* <<rc_filter,Filter>>
* <<rc_simple-cql,Simple CQL>>
* <<rc_enhanced-spatial-operators,Enhanced Spatial Operators>>
* <<rc_spatial-operators,Spatial Operators>>
* <<rc_temporal-operators,Temporal Operators>>
* <<rc_functions,Functions>>
* <<rc_arithmetic,Arithmetic expressions>>
Expand Down
68 changes: 1 addition & 67 deletions extensions/cql/standard/clause_8_simple_cql.adoc
Expand Up @@ -48,7 +48,7 @@ requirements classes in <<cql-enhancements>>:
* The rule `arrayPredicate` is added by requirements class <<rc_arrays,Arrays>>;
* The rule `function` is added by requirements class <<rc_functions,Functions>>;
* The rule `arithmeticExpression` is added by requirements class <<rc_arithmetic,Arithmetic Expressions>>;
* The additional values in rule `spatialOperator` are added by requirements class <<rc_enhanced-spatial-operators,Enhanced Spatial Operators>>;
* The additional values in rule `spatialOperator` are added by requirements class <<rc_spatial-operators,Spatial Operators>>;
* The additional values in rule `temporalOperator` are added by requirements class <<rc_temporal-operators,Temporal Operators>>.

Examples of Simple CQL filter expressions are included in the subsequent sub-clauses.
Expand Down Expand Up @@ -317,72 +317,6 @@ geometry IS NOT NULL
----
====

[[simple-cql_spatial]]
=== Spatial predicates

A _spatial predicate_ evaluates two geometry-valued expressions to determine
if the expressions satisfy the requirements of the specified spatial operator.

In this conformance class, the only required spatial operator is _intersects_.
Additional spatial operators are specified in the <<enhanced-spatial-operators,
Enhanced Spatial Operators>> requirements class.

include::requirements/simple-cql/REQ_spatial-predicates.adoc[]

NOTE: The spatial predicates currently use a different pattern than the
comparison and temporal predicates and are written like function calls.
This difference is inherited from previous versions of CQL. It is an open
issue, whether this version of CQL should change the spatial predicates to
be consistent with the other predicates or to keep the legacy because of
existing CQL implementations. Comments are welcome in the
https://github.com/opengeospatial/ogcapi-features/issues/493[GitHub issue]
on this topic.

CQL uses Well-Known Text (WKT) to encode geometry literals. Since WKT does not
provide a capability to specify the CRS of a geometry literal, the server has
to determine the CRS of the geometry literals in a filter expression through
another mechanism. In this standard, the `filter-crs` query parameter
is used to pass the CRS information to the server.

[[example_8_8]]
.Example spatial predicate
====
----
S_INTERSECTS(geometry,POLYGON((36.319836 32.288087,36.320041 32.288032,36.320210 32.288402,36.320008 32.288458,36.319836 32.288087)))
----
[source,JSON]
----
{ "s_intersects": [
{ "property": "geometry" },
{
"type": "Polygon",
"coordinates": [
[
[36.319836, 32.288087],
[36.320041, 32.288032],
[36.320210, 32.288402],
[36.320008, 32.288458],
[36.319836, 32.288087]
]
]
}
] }
----
====

[[example_8_9]]
.Example for the filter-crs query parameter
====
----
...filter-lang=cql-text&
filter-crs=http://www.opengis.net/def/crs/EPSG/0/32635&
filter=S_INTERSECTS(geometry,POLYGON((379213.87 3610774.16,379233.84 3610769.70,379246.15 3610812.39,379226.49 3610816.88,379213.87 3610774.16)))...
----
Note that the values of the `filter-crs` and `filter` parameters have not been percent-encoded (see section 2.1 of <<rfc3986,RFC 3986>>) in this example for better readability.
====

=== CQL Encodings

This OGC API - Features - Part 3 standard defines a <<simple-cql-text,text>>
Expand Down
87 changes: 61 additions & 26 deletions extensions/cql/standard/clause_9_enhanced.adoc
Expand Up @@ -6,41 +6,37 @@
This clause specifies requirements for enhancements to <<cql-core,Simple CQL>>.
Specifically, this clause defines requirements for:

* Additional spatial operators;
* Additional temporal operators;
* Spatial operators;
* Temporal operators;
* Support for functions in CQL;
* Support for arithmetic expression in CQL;
* Support for arrays in CQL.

In each case, this clause specifies requirements for the rules in <<cql-bnf>>
not supported by Simple CQL.

[[enhanced-spatial-operators]]
=== Requirements Class "Enhanced Spatial Operators"
[[spatial-operators]]
=== Requirements Class "Spatial Operators"

include::requirements/requirements_class_enhanced-spatial-operators.adoc[]
include::requirements/requirements_class_spatial-operators.adoc[]

The <<rc_simple_cql,Simple CQL>> clause specifies the use of the `INTERSECTS`
spatial operator. This requirement adds additional Dimensionally Extended
Nine-intersection Model (DE-9IM) relation operators to the list of spatial
operators that an implementation of this extension might offer.
This requirement adds a set of Dimensionally Extended Nine-intersection Model (DE-9IM) relation operators that may be used to add spatial predicates to a CQL filter expression.

include::requirements/enhanced-spatial-operators/REQ_enhanced-spatial-operators.adoc[]
A _spatial predicate_ evaluates two geometry-valued expressions to determine if the expressions satisfy the requirements of the specified spatial operator.

NOTE: The spatial predicates currently use a different pattern than the
comparison and temporal predicates and are written like function calls.
This difference is inherited from previous versions of CQL. This is an open
issue: Whether this version of CQL used in the OGC API - Features - Part 3
standard should change the spatial predicates to be consistent with the other
predicates or to keep the legacy because of existing CQL implementations.
Comments are welcome in the https://github.com/opengeospatial/ogcapi-features/issues/493[GitHub issue] on this topic.
include::requirements/spatial-operators/REQ_spatial-predicate.adoc[]

The following table lists the mathematical definitions of each spatial operator
as described in <<ogc06-103r4,OpenGIS® Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture>>.
include::requirements/spatial-operators/REQ_spatial-operators.adoc[]

CQL uses Well-Known Text (WKT) to encode geometry literals. Since WKT does not provide a capability to specify the CRS of a geometry literal, the server has to determine the CRS of the geometry literals in a filter expression through another mechanism. In this standard, the `filter-crs` query parameter is used to pass the CRS information to the server.

NOTE: The spatial predicates currently use a different pattern than the comparison and temporal predicates and are written as function calls. This difference is inherited from previous versions of CQL. This is an open issue: Whether this version of CQL used in the OGC API - Features - Part 3 standard should change the spatial predicates to be consistent with the other predicates or to keep the legacy because of existing CQL implementations. Comments are welcome in the https://github.com/opengeospatial/ogcapi-features/issues/493[GitHub issue] on this topic.

The following table lists the mathematical definitions of each spatial operator as described in <<ogc06-103r4,OpenGIS® Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture>>.

[reftext='{table-caption} {counter:table-num}']
.Mathematical definitions of spatial operators
[width=80%,cols="30,70",options="header"]
[width=100%,cols="30,70",options="header"]
|===
|Spatial operator |Definition
|S_CONTAINS |S_CONTAINS(a,b) &#x2b04; b CONTAINS a
Expand All @@ -53,7 +49,7 @@ as described in <<ogc06-103r4,OpenGIS® Implementation Standard for Geographic i
|S_WITHIN |S_WITHIN(a,b) &#x2b04; (a &#x2229; b = a) &#x2227; (I(a) &#x2229; E(b) &#x2260; &#x2205;)
|===

The following diagrams illustrate the meaning of the `S_TOUCHES`, `S_WITHIN`, `S_OVERLAPS`, and `S_CROSSES` operators.
The following diagrams illustrate the meaning of the `S_CROSSES`, `S_OVERLAPS`, `S_TOUCHES` and `S_WITHIN` operators.

[#figure4]
.Examples of the S_CROSSES relationship Polygon/LineString(a) and LineString/LineString(b).
Expand Down Expand Up @@ -168,6 +164,45 @@ S_WITHIN(road,Buffer(geometry,10,"m"))
----
====

[[example_9_4]]
.Example spatial predicate
====
----
S_INTERSECTS(geometry,POLYGON((36.319836 32.288087,36.320041 32.288032,36.320210 32.288402,36.320008 32.288458,36.319836 32.288087)))
----
[source,JSON]
----
{ "s_intersects": [
{ "property": "geometry" },
{
"type": "Polygon",
"coordinates": [
[
[36.319836, 32.288087],
[36.320041, 32.288032],
[36.320210, 32.288402],
[36.320008, 32.288458],
[36.319836, 32.288087]
]
]
}
] }
----
====

[[example_9_5]]
.Example for the filter-crs query parameter
====
----
...filter-lang=cql-text&
filter-crs=http://www.opengis.net/def/crs/EPSG/0/32635&
filter=S_INTERSECTS(geometry,POLYGON((379213.87 3610774.16,379233.84 3610769.70,379246.15 3610812.39,379226.49 3610816.88,379213.87 3610774.16)))...
----
Note that the values of the `filter-crs` and `filter` parameters have not been percent-encoded (see section 2.1 of <<rfc3986,RFC 3986>>) in this example for better readability.
====

[[temporal-operators]]
=== Requirements Class "Temporal Operators"

Expand Down Expand Up @@ -250,7 +285,7 @@ event_date T_INTERSECTS 1969-07-16T05:32:00Z/1969-07-24T16:50:35Z
----
====

[[example_9_4]]
[[example_9_6]]
.Examples of temporal relationships using temporal literals.
====
----
Expand All @@ -266,7 +301,7 @@ event_date T_INTERSECTS 1969-07-16T05:32:00Z/1969-07-24T16:50:35Z
----
====

[[example_9_5]]
[[example_9_7]]
.Examples of temporal relationships using a property and a temporal literal.
====
----
Expand Down Expand Up @@ -302,7 +337,7 @@ include::requirements/functions/REQ_get-functions-operation.adoc[]

include::requirements/functions/REQ_get-functions-response-json.adoc[]

[[example_9_6]]
[[example_9_8]]
.Get functions JSON response example
====
[source,JSON]
Expand Down Expand Up @@ -361,7 +396,7 @@ include::requirements/arithmetic/REQ_arithmetic.adoc[]

NOTE: Support for the BNF rule `function` is added by the requirements class <<rc_functions,Functions>>.

[[example_9_7]]
[[example_9_9]]
.Predicate with an arithmetic expression finding all vehicles that are too tall to pass under a bridge.
====
----
Expand Down Expand Up @@ -393,7 +428,7 @@ the requirements class <<rc_functions,Functions>>.
Support for the BNF rule `arithmeticExpression` is added by
the requirements class <<rc_arithmetic,Arithmetic Expressions>>.

[[example_9_8]]
[[example_9_10]]
.Evalute if the value of an array property contains the specified subset of values.
====
----
Expand Down

This file was deleted.

@@ -0,0 +1,16 @@
[[req_cql-json_spatial-operators]]
[width="90%",cols="2,6a"]
|===
^|*Requirement {counter:req-id}* |*/req/cql-json/spatial-operators*
^|Condition |Server implements requirements class <<rc_spatial-operators,Spatial Operators>>
^|A |The server SHALL be able to parse and evaluate filter expressions encoded as JSON that use the following schema components:

* "#/$defs/s_containsExpression"
* "#/$defs/s_crossesExpression"
* "#/$defs/s_disjointExpression"
* "#/$defs/s_equalsExpression"
* "#/$defs/s_intersectsExpression"
* "#/$defs/s_overlapsExpression"
* "#/$defs/s_touchesExpression"
* "#/$defs/s_withinExpression"
|===

This file was deleted.

@@ -0,0 +1,7 @@
[[req_cql-text_spatial-operators]]
[width="90%",cols="2,6a"]
|===
^|*Requirement {counter:req-id}* |*/req/cql-text/spatial-operators*
^|Condition |Server implements requirements class <<rc_spatial-operators,Spatial Operators>>
^|A |The server SHALL be able to parse and evaluate all spatial operators encoded as a text string that validate against the BNF production fragment identified in the <<req_spatial-operators,Spatial Operators>> requirement.
|===

This file was deleted.

Expand Up @@ -6,7 +6,7 @@
|Target type |Representations of a filter expression
|Dependency |<<rc_simple-cql,Requirements Class "Simple CQL">>
|Dependency |<<GeoJSON,GeoJSON>>
|Conditional Dependency |<<rc_enhanced-spatial-operators,Requirements Class "Enhanced Spatial Operators">>
|Conditional Dependency |<<rc_spatial-operators,Requirements Class "Spatial Operators">>
|Conditional Dependency |<<rc_temporal-operators,Requirements Class "Temporal Operators">>
|Conditional Dependency |<<rc_functions,Requirements Class "Functions">>
|Conditional Dependency |<<rc_arithmetic,Requirements Class "Arithmetic Expressions">>
Expand Down
Expand Up @@ -6,7 +6,7 @@
|Target type |Representations of a filter expression
|Dependency |<<rc_simple-cql,Requirements Class "Simple CQL">>
|Dependency |<<ogc06-103r4,Simple feature access - Part 1: Common architecture, Well-known Text Representation for Geometry>>
|Conditional Dependency |<<rc_enhanced-spatial-operators,Requirements Class "Enhanced Spatial Operators">>
|Conditional Dependency |<<rc_spatial-operators,Requirements Class "Spatial Operators">>
|Conditional Dependency |<<rc_temporal-operators,Requirements Class "Temporal Operators">>
|Conditional Dependency |<<rc_functions,Requirements Class "Functions">>
|Conditional Dependency |<<rc_arithmetic,Requirements Class "Arithmetic Expressions">>
Expand Down
@@ -1,8 +1,8 @@
[[rc_enhanced-spatial-operators]]
[[rc_spatial-operators]]
[cols="1,4",width="90%"]
|===
2+|*Requirements Class*
2+|http://www.opengis.net/spec/ogcapi-features-3/1.0/req/enhanced-spatial-operators
2+|http://www.opengis.net/spec/ogcapi-features-3/1.0/req/spatial-operators
|Target type |Filter expressions
|Dependency |<<rc_simple-cql,Requirements Class "Simple CQL">>
|Dependency |<<ogc06-103r4,OGC Simple feature access - Part 1: Common architecture, Architecture>>
Expand Down

0 comments on commit 2bae926

Please sign in to comment.