Skip to content
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

WKT syntax for rectangles #36

Closed
sibartlett opened this issue Mar 22, 2013 · 7 comments
Closed

WKT syntax for rectangles #36

sibartlett opened this issue Mar 22, 2013 · 7 comments
Milestone

Comments

@sibartlett
Copy link

Support should be added for the following WKT syntax. I don't think it's defined in any standard, but several existing GIS libraries/systems already support this syntax (including PostGIS and Geotoolkit).

BOX2D(-180.0 -90.0, 180.0 90.0)

@dsmiley
Copy link
Contributor

dsmiley commented Mar 22, 2013

It seems instead to be a bounding-box function: http://www.postgis.org/docs/Box2D.html

@sibartlett
Copy link
Author

Ah, I should maybe have done a bit more reading on the PostGIS documentation. I just saw threads where users were using BOX2D strings in their queries.

Looking at the geotoolkit documentation for Envelopes:

The parseWKT accepts both:

BOX(-180 -90, 180 90) and BOX2D(-180 -90, 180 90)

The toWKT outputs:

BOX2D(-180 -90, 180 90)

@sibartlett
Copy link
Author

I've now taken a look at the PostGIS documentation, and have noticed the Box2D is not just a function, but also a type: http://www.postgis.org/docs/box2d_type.html

From what I saw I think the box types in PostGIS (Box2D/Box3D) can be cast to/from strings in the BOX(-180 -90, 180 90) and BOXnD(-180 -90, 180 90) formats.

@dsmiley
Copy link
Contributor

dsmiley commented Nov 20, 2013

WKT syntax for rectangles was added with this commit: spatial4j/spatial4j@198dc13
It's the ENVELOPE(minX, maxX, maxY, minY) format in OGC "Catalogue Services Specification", the "CQL" (Common Query Language) sub-spec. I hate the argument order of maxY then minY but it isn't my spec.

I'll leave this issue open until I add BOX & BOX2D.

@sibartlett
Copy link
Author

I agree, I don't like the argument order either. Thanks for pointing out the ENVELOPE syntax in the Catalogue Services Specification though, that's useful to know. :)

@dsmiley
Copy link
Contributor

dsmiley commented Nov 21, 2013

I'm not really seeing much out support out there for BOX & BOX2D. The geotoolkit.org links you have no longer show the WKT methods you refer to, and I wonder who uses geotoolkit any way. In PostGIS, it isn't apparent in the documentation at all that BOX & BOX2D are parseable WKT (even if you may happen to know that is so). I haven't tried. Do you believe it is and people use it? So I'm inclined to pass on BOX/BOX2D for now.

I don't know if I should close the issue based on satisfying the title of the issue, or rename the title to have BOX & BOX2D.

@sibartlett
Copy link
Author

The BOX/BOX2D/BOX3D syntax seems to be supported in PostGIS, but I think maybe only in some (not all) scenarios.

I think the ENVELOPE syntax you have introduced is sufficient, especially given it is from one of the OGC specifications.

I'll close this issue, and will consider reopening in the future if I find wider usage of the BOX syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants