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

PostGIS trac at osgeo.org
Thu Mar 15 06:34:32 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):

 Sorry for unclear question. I know the default tolerance is 32 segments
 per quadrant, which is too parse and which is the reason for all problems
 in this ticket.
 The real question is: if we use this tolerance-parameter you propose
 inside PostGIS with some default tolerance value, then what would be good
 value?
 And because different users want to use different tolerance, how can we
 make it possible for them to set that parameter in table-level?

 Some example calculation about values:

 From equation:
 cos(angle_sector / 2) = (radius - tolerance) / radius
 =>
 tolerance = radius - radius * cos(angle_sector / 2)

 If radius = 1000m and angle_sector = (PII/2) / 32 = 0.049rad
 =>
 tolerance = 30cm and length of arc is 49m
 That is just too big tolerance.

 If we want tolerance to be 0.0005m then angle_sector would be
 angle_sector = 2 * acos((radius - tolerance) / radius)
 =>
 angle_sector = 0.002rad = 785 segments per quadrant

 If we put 10 000 segments per quadrant for arc with radius of 1000m
 =>
 tolerance = 0.000003m which is quite enough for practical use I think.

 Because arc is just mathematical entity to express line and necessarily
 not any real structure, people can have arcs with radius for example from
 1mm to 100km.
 With 100km radius and 10 000 segments per quadrant, we get tolerance =
 0.0003m

 So, as a result, either we want possibility to put "segments per quadrant"
 parameter something between 1000 - 10 000 or we want possibility to put
 "tolerance" parameter something between 0.0001 - 0.001.
 The later one is normal and better way to parametrize linearizations in
 GIS-applications and databases.

 P.S  I fixed my real data tolerance values in my last message.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3719#comment:13>
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