[postgis-users] Unexpected ST_DWithin result when using geography

satoshi satoshich at gmail.com
Sun Feb 6 23:28:11 PST 2022


Hello,

This query:

```
SELECT ST_DWithin(
  ST_Buffer('SRID=4326;LINESTRING(7.1670005 45.9968257,7.1670216
45.9969537,7.1670216 45.9971326, 7.1670484 45.9972789, 7.1671905
45.9974074, 7.1672844 45.9974801, 7.1659165 46.0005209, 7.1653103
46.0010221, 7.1652359 46.0013015)'::geography, 1.0),
  'SRID=4326;POINT(7.1672844 45.9974801)'::geography,
  0.0
);
```

Returns `FALSE`. Note that the point that is passed as the second parameter
to `ST_DWithin` is part of the `LINESTRING` passed in the first parameter,
so I expect it to return `TRUE`.

When removing the first or last point from the `LINESTRING`, then it
correctly returns `TRUE`.

When using `geometry` instead of `geography` and using 0.0000105 for the
buffer (which is roughly 1 meter at that latitude), then it correctly
returns `TRUE`.

Could somebody comment on this and let me know why this would happen (if
not a bug)?

Thank you,
Dario
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220207/ede362f5/attachment.html>


More information about the postgis-users mailing list