Changes between Version 1 and Version 2 of Ticket #3719, comment 1


Ignore:
Timestamp:
Mar 24, 2017, 11:13:58 AM (7 years ago)
Author:
tiiipponen

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3719, comment 1

    v1 v2  
    11I tried to look this a bit more just by looking code, but couldn't find anything clear.
    2 I noticed, that even ST_Intersects does not return error for hole part, it actually returns false, which is not right answer. I noticed also, that validation shows problem for hole too, so I created simpler example:
     2\\I noticed, that even ST_Intersects does not return error for hole part, it actually returns false, which is not right answer. I noticed also, that validation shows problem for hole too, so I created simpler example:
    33
     4{{{
    45select ST_IsValidDetail(
    56  ST_GeomFromText(
     
    1516  )
    1617);
    17 
     18}}}
    1819Result:
    1920
     
    2122
    2223I tried to look code and only thing that makes me suspicious is this:
    23 liblwgeom/lwgeom_geos.c ->
    24 -> LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
    25 -> LWGEOM *lwgeom_stroked = lwgeom_stroke(lwgeom, 32);
    26 -> liblwgeom/lwstroke.c -> lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
     24\\liblwgeom/lwgeom_geos.c ->
     25\\-> LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
     26\\-> LWGEOM *lwgeom_stroked = lwgeom_stroke(lwgeom, 32);
     27\\-> liblwgeom/lwstroke.c -> lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
    2728
    2829I don't know the stroking value perQuad, but if it is default PostGIS value 32, it leads to arc length 0.78 m, which is more than length of actual arc 0.71m. That would create straight line as a stroking result of that arc and that can give the error message "Invalid number of points...".
    29 I adjusted example coordinates a little so that arc was longer and error message disappeared.
     30\\I adjusted example coordinates a little so that arc was longer and error message disappeared.
    3031
    3132If this is the reason, then this problem is not so easy to fix. We can have very short arcs in our data and using same absolute stroking length means troubles.
    32 I would think more, if things could do completely without stroking.
    33 At least I would use relative stroking compared to arc length.
    34 As a stroking method, I like most the tolerance method. Tolerance means maximum difference between original arc an stroked line.
    35 I created following code with Python for you to copy (and test!) freely:
    36 User can give parameters accuracy "tolerance" or number of "vertices" in resulting stroked line.
     33\\I would think more, if things could do completely without stroking.
     34\\At least I would use relative stroking compared to arc length.
     35\\As a stroking method, I like most the tolerance method. Tolerance means maximum difference between original arc an stroked line.
     36\\I created following code with Python for you to copy (and test!) freely:
     37\\User can give parameters accuracy "tolerance" or number of "vertices" in resulting stroked line.
    3738
     39{{{
    3840    # If user gave the stroking tolerance, we calculate maximum angle of one stroke sector.
    3941    # from equation: cos(angle / 2) = (radius - tolerance) / radius
     
    7779       
    7880    pointList.append((p3x, p3y))
    79 
     81}}}
    8082
    8183Ok. Lots of text and actual error can lie completely somewhere else.
    82 I wish good luck for solving this, because function ST_Intersects is widely used in QGIS, Openlayers, etc. and this error results missing geometries and error messages in data that holds arcs.
     84\\I wish good luck for solving this, because function ST_Intersects is widely used in QGIS, Openlayers, etc. and this error results missing geometries and error messages in data that holds arcs.