ST_Distance() query error

Paul Ramsey pramsey at cleverelephant.ca
Mon Sep 15 08:18:37 PDT 2025


This seems. net new. I haven’t verified locally, but I assume you’ve found something. 
There is not any ongoing development on arc distances, but we do work on verified bugs as a matter of course. You can speed things up, as always, by shrinking your demonstration case. The fewer vertices I have to wade through, the faster the cause can be identified.
ATB,
P

> On Sep 15, 2025, at 3:43 AM, Juho Rekilä via postgis-users <postgis-users at lists.osgeo.org> wrote:
> 
> Hi,
> 
> The ST_Distance() query below gives the result of 0 m for the distance between two features. The result is wrong as the features are actually approximately 0,2 meters away from each other.
> 
> This error is also problematic because Geoserver now uses the ST_Distance() function when searching for objects that are touching each other, for example.
>  
> The PostgreSQL and PostGIS versions used:
> PostgreSQL 17.5 (Ubuntu 17.5-1.pgdg24.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, 64-bit
> POSTGIS="3.5.3 aab5f55" [EXTENSION] PGSQL="170" GEOS="3.12.1-CAPI-1.18.1"
> 
> The ST_Distance() query: 
> 
> SELECT
>   ST_Distance(
>     ST_GeomFromText('MULTISURFACE(CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(25498687.296406467 6679794.584487298,25498670.728066746 6679772.920079741,25498652.7219 6679752.4351),(25498652.7219 6679752.4351,25498649.618 6679749.1379,25498615.3055 6679712.6856,25498584.874 6679680.3574),CIRCULARSTRING(25498584.874 6679680.3574,25498575.9211 6679678.4791,25498571.0593 6679686.228),(25498571.0593 6679686.228,25498572.5718 6679717.5059,25498572.5935 6679717.9476,25498572.6156 6679718.3893),CIRCULARSTRING(25498572.6156 6679718.3893,25498575.9546 6679753.1238,25498582.4167 6679787.4148,25498582.6547 6679788.418,25498582.8953 6679789.4206),(25498582.8953 6679789.4206,25498583.4717 6679791.8086,25498577.35416496 6679793.28540422),(25498577.35416496 6679793.28540422,25498558 6679652,25498706 6679794,25498687.296406467 6679794.584487298))))', 3879)
>     ,ST_GeomFromText('POLYGON((25498577.925067347 6679764.376426865,25498577.31346041 6679760.722689815,25498576.736966014 6679757.06324837,25498576.19563731 6679753.398439955,25498575.68952422 6679749.72860249,25498575.218673404 6679746.054074359,25498574.783128276 6679742.375194377,25498574.382929 6679738.692301761,25498574.01811248 6679735.005736099,25498573.68871235 6679731.315837314,25498573.394758984 6679727.622945643,25498615.249195762 6679712.917382107,25498649.317714863 6679749.110582217,25498629.859234665 6679763.425791496,25498626.597285368 6679765.4664939325,25498616.53215853 6679754.940559511,25498616.475998268 6679754.899373339,25498616.40912013 6679754.879941631,25498616.33963356 6679754.884620618,25498577.925067347 6679764.376426865))', 3879)
>     ) AS dist
> 
> Have you encountered this issue before and is there an ongoing development that will address this?
> 
> Kind regards,
> Juho
> Gispo Finland Ltd.
> https://www.gispo.fi/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20250915/6731736f/attachment.htm>


More information about the postgis-users mailing list