Changes between Version 1 and Version 2 of Ticket #3719, comment 1
- Timestamp:
- 03/24/17 11:13:58 (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3719, comment 1
v1 v2 1 1 I 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: 3 3 4 {{{ 4 5 select ST_IsValidDetail( 5 6 ST_GeomFromText( … … 15 16 ) 16 17 ); 17 18 }}} 18 19 Result: 19 20 … … 21 22 22 23 I 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) 27 28 28 29 I 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. 30 31 31 32 If 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. 37 38 39 {{{ 38 40 # If user gave the stroking tolerance, we calculate maximum angle of one stroke sector. 39 41 # from equation: cos(angle / 2) = (radius - tolerance) / radius … … 77 79 78 80 pointList.append((p3x, p3y)) 79 81 }}} 80 82 81 83 Ok. 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.