[postgis-tickets] [PostGIS] #3719: Error: Invalid number of points in LinearRing

PostGIS trac at osgeo.org
Thu Mar 22 05:02:03 PDT 2018


#3719: Error: Invalid number of points in LinearRing
-------------------------+-----------------------------
  Reporter:  tiiipponen  |      Owner:  pramsey
      Type:  defect      |     Status:  new
  Priority:  medium      |  Milestone:  PostGIS Fund Me
 Component:  postgis     |    Version:  2.3.x
Resolution:              |   Keywords:
-------------------------+-----------------------------

Comment (by tiiipponen):

 Here is my proposal for code lines in function lwarc_linearize() in file
 lwstroke.c. \\
 I didn't test it, but afterwards I am ready to test this fix well with our
 database data.

 {{{
 static int
 lwarc_linearize(POINTARRAY *to,
                  const POINT4D *p1, const POINT4D *p2, const POINT4D *p3,
                  double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type,
                  int flags)
 {
         POINT2D center;

 ...

 row 235:
         /* Angles of each point that defines the arc section */
         a1 = atan2(p1->y - center.y, p1->x - center.x);
         a2 = atan2(p2->y - center.y, p2->x - center.x);
         a3 = atan2(p3->y - center.y, p3->x - center.x);

         LWDEBUGF(2, "lwarc_linearize A1:%g (%g) A2:%g (%g) A3:%g (%g)",
                 a1, a1*180/M_PI, a2, a2*180/M_PI, a3, a3*180/M_PI);

         /* Calculate total arc angle, in radians */
         double angle = clockwise ? a1 - a3 : a3 - a1;
         if ( angle < 0 ) angle += M_PI * 2;

         /* Setting minimum of 6 segments if needed */
         if ( (angle / increment) < 6.0 )
         {
                 LWDEBUGF(2, "lwarc_linearize: setting minimum of 6
 segments");
                 increment = angle / 6.0;
         }

         if ( flags & LW_LINEARIZE_FLAG_SYMMETRIC )
         {{
                 LWDEBUGF(2, "lwarc_linearize SYMMETRIC requested - total
 angle %g deg",
                                  angle * 180 / M_PI);
                 if ( flags & LW_LINEARIZE_FLAG_RETAIN_ANGLE )
                 {{
                         /* Number of steps */
                         int steps = trunc(angle / increment);
 ...
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3719#comment:18>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list