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

Comment regarding circle in circular-geometry-objects.adoc proposal #135

Open
heidivanparys opened this issue Jan 29, 2025 · 4 comments
Open

Comments

@heidivanparys
Copy link

The current proposal states:

A Circle consists of 4 positions with circular interpolation being used between positions. It starts at the first position, goes through the second position, followed by the third position and ends at the fourth position. The first and fourth position must be equivalent, which requires the Circle to be closed.

The coordinates of the second and third position determine the direction of the Circle.

In GML, a circle is described as follows:

A Circle is an arc whose ends coincide to form a simple closed loop. The three control points shall be distinct non co-linear points for the circle to be unambiguously defined. The arc is simply extended past the third control point until the first control point is encountered.

In SQL/MM (ISO/IEC 13249-3:2016), the text regarding type ST_Circle is almost the same as the text in the GML specification. The meaning is the same, the wording a bit different. Most importantly, a circle is also defined by three points.

Is it a good idea to deviate from the approach that both GML and SQL/MM take?

@cportele
Copy link
Member

Thank you for raising this topic. I do not have access to SQL/MM (only to drafts found on the web, the latest a CD from 2012), so I do not really know how circle is currently defined in SQL/MM. However, I am not aware of implementations of circle in DBMSs. I checked PostGIS, Oracle and Spatialite and did not find any indication of support for the geometry type. If that is the case, I think we should not include circle as a geometry type. A circle can be written as a closed circular string with two arcs.

@heidivanparys
Copy link
Author

heidivanparys commented Jan 30, 2025

PostGIS does have support for circles. Not as a separate type, but as a special case of a circular string, see also https://postgis.net/docs/using_postgis_dbmanagement.html#CircularString. This approach is not (no longer) compliant to (the current edition of) SQL/MM though, see e.g. OSGeo/gdal#11750.

Oracle also has support for circles (see e.g. https://docs.oracle.com/en/database/oracle/oracle-database/19/spatl/spatial-datatypes-metadata.html#GUID-5A7FCD16-E726-430F-91BE-56D7F7BAA359).

An example (executed in an Oracle 19 database):

WITH geometry AS (
	SELECT
		sdo_geometry (2003, -- 2D surface
		NULL,
		NULL,
		sdo_elem_info_array (1, -- SDO_STARTING_OFFSET
		1003, -- exterior polygon ring
		4), -- circle
		sdo_ordinate_array (-1,2,1,0,3,2)) -- coordinates
		AS sdo
	FROM
		dual)
SELECT
	sdo_util.to_wktgeometry(g.sdo) AS wkt,
	sdo_util.to_gml321geometry(g.sdo) AS gml,
	sdo_util.to_json(g.sdo) AS json
FROM
	geometry g;

The (formatted) output of the above query:

WKT

CURVEPOLYGON (CIRCULARSTRING (1.0 0.0, 3.0 2.0, 1.0 4.0, -1.0 2.0, 1.0 0.0))

GML

<gml:Polygon gml:id="ID0001"
             srsName="SDO:"
             xmlns:gml="http://www.opengis.net/gml/3.2">
    <gml:exterior>
        <gml:Circle>
            <gml:posList srsDimension="2">-1.0 2.0 1.0 0.0 3.0 2.0 </gml:posList>
        </gml:Circle>
    </gml:exterior>
</gml:Polygon>

JSON

{
  "polygon": {
    "boundary": [
      {
        "circle": {
          "datapoints": [
            [
              1,
              0
            ],
            [
              3,
              2
            ],
            [
              1,
              4
            ]
          ]
        }
      }
    ]
  }
}

@cportele
Copy link
Member

OK, but this is not the CIRCLE WKT, this is basically the "circular string with two arcs" I mentioned above. At least in WKT, which is what we try to align JSON-FG with.

@heidivanparys
Copy link
Author

Agree, the CIRCLE WKT is in Oracle not (yet?) supported indeed.

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