Opened 6 years ago
Closed 3 years ago
#4326 closed defect (fixed)
Circular strings distances are wrong
Reported by: | komzpa | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.5.3 |
Component: | postgis | Version: | 2.4.x |
Keywords: | Cc: |
Description
03:23:10 [kom] > select ST_Distance('CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(1 6, 6 1, 9 7),(9 7, 3 13, 1 6)),COMPOUNDCURVE((3 6, 5 4, 7 4, 7 6),CIRCULARSTRING(7 6,5 8,3 6)))', 'CURVEPOLYGON(CIRCULARSTRING(-1 4, 0 5, 1 4, 0 3, -1 4))'); ┌────────────────────┐ │ st_distance │ ├────────────────────┤ │ 0.0475665993629137 │ └────────────────────┘ (1 row) Time: 35,112 ms 03:23:53 [kom] > select ST_Distance('CURVEPOLYGON(CIRCULARSTRING(-1 4, 0 5, 1 4, 0 3, -1 4))','CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(1 6, 6 1, 9 7),(9 7, 3 13, 1 6)),COMPOUNDCURVE((3 6, 5 4, 7 4, 7 6),CIRCULARSTRING(7 6,5 8,3 6)))');┌─────────────┐ │ st_distance │ ├─────────────┤ │ 0 │ └─────────────┘ (1 row) Time: 1,292 ms
To find more: swap lw1 and lw2 in https://github.com/postgis/postgis/blob/svn-trunk/liblwgeom/cunit/cu_measures.c#L65
Change History (17)
comment:1 by , 6 years ago
Milestone: | PostGIS 2.5.2 → PostGIS 2.5.3 |
---|
comment:2 by , 6 years ago
comment:6 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 by , 4 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
As noted by abobov on IRC this returns 0 instead of some non-zero answer
WITH DATA AS (SELECT 'SRID=3857;CURVEPOLYGON(CIRCULARSTRING(7874821 8715927,8907663 8715927,8844683 7750316,7937800 7750316,7874821 8715927))'::geometry AS a, 'SRID=3857;Point (5433865 8243495)'::geometry AS b) SELECT st_distance(a, b), a && b AS bbox_intersect FROM DATA;
Returns:
0 false
I would expect it to return something in ballpark of applying ST_LineToCurve answer:
WITH DATA AS (SELECT ST_CurveToLine('SRID=3857;CURVEPOLYGON(CIRCULARSTRING(7874821 8715927,8907663 8715927,8844683 7750316,7937800 7750316,7874821 8715927))'::geometry) AS a, 'SRID=3857;Point (5433865 8243495)'::geometry AS b) SELECT st_distance(a, b) FROM DATA;
which returns:
2271892.5770899933
comment:8 by , 3 years ago
The right answer pops out when it's just a point/line distance, so the problem must line in the containment test.
WITH data AS ( SELECT 'CIRCULARSTRING(7874821 8715927,8907663 8715927,8844683 7750316,7937800 7750316,7874821 8715927)'::geometry AS a, 'POINT(5433865 8243495)'::geometry AS b ) SELECT ST_Distance(a, b), a && b AS bbox_intersect FROM data;
comment:15 by , 3 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Added test broke many of the bots not running GEOS 3.9 see #4963
comment:17 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Note:
See TracTickets
for help on using tickets.
In 17385: