[Qgis-developer] Interpretation of a 3 point CircularString with p0 == p2 (circle)
even.rouault at spatialys.com
Thu Jun 23 06:32:20 PDT 2016
I just came into a difference how QGIS and GDAL interpret a CircularString made
of a 3 points p0, p1, p2 where p0 == p2, which is a way of representing a full
GDAL interprets p1 as the symetrical point of p0 with respect to the center
that is p1 is on the perimeter of the circle, or said otherwise the center of
the circle is the midpoint of [p0,p1].
Whereas QGIS interprets p1 as the center of the circle (
I'd think GDAL interpretation is the right one, since according to
http://jtc1sc32.org/doc/N1101-1150/32N1107-WD13249-3--spatial.pdf (ISO SQL MM
Part 3), paragraph 4.1.6 :
(let's call this sentence S1)
""" In the case where the segment is a circle, then the center is located
at the midpoint of the line connecting the start point with the intermediate
But if you look a bit above in the paragraph, there's a sentence (call it S2)
: """In the special case where a segment is a complete circle, that is, the
start and end points are coincident, then the intermediate point shall be the
midpoint of the segment. """, which looks confusing at first. I think this
sentence must be interpreted considering distances along the curve, in which
case the "midpoint of the segment" when doing a full walk along the circle
from p0 back to p0 is the symetrical point of p0 with respect to the center.
I think this interpretation is also more logical since, even in that
particular case, p0,p1,p2 are all on the arc, like in the general case.
I can also see that PostGIS (in https://github.com/postgis/postgis/blob/svn-
trunk/liblwgeom/lwalgorithm.c#L252 ) has the same interpretation as GDAL (*)
I'd be happy to read opinions regarding this.
(*) Can also be shown with :
POLYGON((-1 -1,-1 1,1 1,1 -1,-1 -1))
And http://postgis.net/docs/manual-2.2/using_postgis_dbmanagement.html says
"The exception to this is for a closed circle, where the start and end points
are the same. In this case the second point MUST be the center of the arc, ie
the opposite side of the circle.", which is another way to rephrase S2.
Spatialys - Geospatial professional services
More information about the Qgis-developer