3 | | I'm not sure how ST_DistanceSphere avoids the issue since it looks like it probably goes down a similar codepath |
| 3 | ~~I'm not sure how ST_DistanceSphere avoids the issue since it looks like it probably goes down a similar codepath~~ |
| 4 | |
| 5 | ST_DistanceSphere actually has the same issue **IF** you explicitly provide the optional third parameter (world radius in metres) |
| 6 | |
| 7 | {{{ |
| 8 | #!sql |
| 9 | => select st_distancesphere('SRID=4326;POLYGON((0 0,0 1,1 1,1 0,0 0))'::GEOMETRY, 'SRID=4326;POINT(0.5 0.5)'::geometry, 6371008); |
| 10 | 55595.41609801024 |
| 11 | }}} |
| 12 | |
| 13 | It looks like if you omit that parameter it doesn't use the buggy codepath - instead it casts your geometries to geographies and calls `geography_distance` which doesn't have the same problem. |