-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CQL2 (Text): WKT Definition #800
Comments
the WKT specification is: https://docs.opengeospatial.org/is/18-010r7/18-010r7.html |
Unfortunately that is WKT for Coordinate Reference Systems and not geometries. I was referring to ISO/IEC 13249-3:2016. The best I have found are these two:
I thought there was more of an issue with how "EMPTY" was being handled in various grammars. Where
To match those definitions "EMTPY" should be on
Unfortunately, that does lead to some compatibility issues with GeoJSON. If you have So really, everything related to "EMPTY" is a mess. |
Found this to be open since almost one year. It seems that this issue has not been considered/addressed in the draft that is currently under vote at the SWG? I guess at least 3D coordinates need fixing in the BNF. |
@eseglem - Apologies, we overlooked this issue. OGC WKT is defined in the normative reference OGC 06-103r4: OpenGIS® Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture. As far as I know, the SQL MM WKT extends OGC WKT. On the comments/proposals, I agree with all the issues that you have identified and will create a PR. The WKT grammar in 7.2.3 of OGC 06-103r4 for 3D coordinates includes a "z". So we should do this in CQL2 as well. I also would say that we should prohibit the inclusion of a GEOMETRYCOLLECTION in another GEOMETRYCOLLECTION like we do in CQL2 JSON (the PR #902 already adds GeometryCollection to the CQL2 JSON schema). The only aspect from you list that I am unsure about is the inclusion of EMPTY geometries. The GeoJSON schemas do not support something like If we would allow EMPTY in CQL2 Text, it would still not be possible to represent something like
PS: By the way, the WKT grammar allows |
Closes #800. As discussed in #800 (comment), all suggestions are included except the proposal to support EMPTY in WKT geometries. In addition, the following changes are included: - change version and document generation to 21-065r1 - add missing requirements for the `basic-spatial-functions-plus` requirements class in the encoding requirements classes - add missing conditional dependencies in the encoding ATSs - fix a spelling mistake in the ATS - fix an incorrect requirement identifier
I have noticed a few things which may be issues with the WKT definition in the grammar BNF. There are multiple definitions for WKT around, and I don't actually have access to the ISO spec, so it is hard to be certain what is correct and what isn't.
point
is defined with an optional Z coord:xCoord yCoord [zCoord]
but none of the*TaggedText
allow for a "Z" in the text. For example:POINT Z (0 0 0)
would be the correct (or at least standard) way to write a 3D point in WKT. But would not be valid according to the grammar.["Z"]
to each of the*TaggedText
definitions.BBOX
does not seem to be a part of actual WKT but it is included inspatialLiteral
. So, according to the grammar, you could haveGEOMETRYCOLLECTION (BBOX (0 0 0 0), BBOX (0 0 0 0 0 0))
but tools like shapely and PostGIS are not able to parse that.geometryLiteral
withoutbboxTaggedText
and use it forgeometryCollectionText
EMPTY
as an option. SoPOLYGON EMPTY
would not be parseable. This may be intentional, but I could see some value in having it:S_EQUALS("my_geom", POLYGON EMPTY)
. And if nothing else, it would seem to be a compatibility issue."EMPTY"
to each of the*TaggedText
definitions.*Text
that would allow weird things likePOLYGON (EMPTY, EMPTY)
which also doesn't work.I don't know if the following are actually incorrect or not but they do seem to lead to compatibility issues. It doesn't appear to be possible to use some values which are valid in the grammar as input to many tools. It is also an issue when trying to go back and forth between
cql2-text
andcql2-json
.{"," point}
is repeated 0 or more times, the grammar allows forLINESTRING(0 0)
. But that isn't a valid LineString in GeoJSON and tools like shapely and PostGIS throw an error when trying to parse it. They require at least 2 points.lineStringText = "(" point "," point {"," point} ")";
Requiring at least 2 points..POLYGON((0 0, 1 1))
which also cannot be represented by GeoJSON or parsed by other tools. They require at least 4 points. (And the last point needs to be the same as the first, but I don't think that part can be represented in BNF.)linearRingText = "(" point "," point "," point "," point {"," point } ")";
to require at least 4 points and use it instead of linepolygonText = "(" linearRingText {"," linearRingText } ")";
All of that combined would be something like this:
The text was updated successfully, but these errors were encountered: