Opened 7 years ago

Closed 7 years ago

#2002 closed defect (fixed)

Circle geometry handling

Reported by: xificurk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.2
Component: postgis Version: 2.0.x
Keywords: Cc:

Description

The documentation states in 4.1.3. SQL-MM Part 3:

"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."

But it seems that postgis does not handle these geometries well.

=> SELECT ST_AsText(ST_CurveToLine(ST_GeomFromText('CURVEPOLYGON(CIRCULARSTRING(-1 0,1 0,-1 0))')));

st_astext


POLYGON((1 0,-1 0,-1 0))

The result is invalid polygon. The workaround is simple - use more points in circular string, e.g.: => SELECT ST_AsText(ST_CurveToLine(ST_GeomFromText('CURVEPOLYGON(CIRCULARSTRING(-1 0, 0 1, 1 0, 0 -1, -1 0))'), 2));

st_astext


POLYGON((-1 1.22460635382238e-16,-0.707106781186547 0.707106781186548,6.12303176911189e-17 1,0.707106781186548 0.707106781186547,1 0,0.707106781186548 -0.707106781186547,6.12303176911189e-17 -1,-0.707106781186547 -0.707106781186548,-1 0))

Change History (1)

comment:1 Changed 7 years ago by pramsey

Resolution: fixed
Status: newclosed

This is now fixed in 2.0 and trunk, not sure at what revision.

SELECT ST_Area(ST_CurveToLine(ST_GeomFromText('CURVEPOLYGON(CIRCULARSTRING(-1 0,1 0,-1 0))')));
Note: See TracTickets for help on using tickets.