[postgis-users] Definition of St_Distance in case of 2 non point geometries

Rémi Cura remi.cura at gmail.com
Fri Oct 18 07:42:18 PDT 2013


Hey,
this is partially true.

It behaves strangely when you hit precision limits.

Cheers,
Rémi-C


2013/10/18 Nicklas Avén <nicklas.aven at jordogskog.no>

> If I understand you right your assumption is true.
>
>  What makes you wondering?
>
>  In 2d you will always get the distance to a vertexpoint in at least one
> of the two geometries.
>
>  You can use ST_ShortestLine to see between what points the distance is
> calculated.
>
>  So:
>
>  SELECT ST_Distance('LINESTRING(1 1, 1 10)'::geometry, 'LINESTRING(2 5,
> 10 5)'::geometry);
>  returns 1
> and
> SELECT ST_AsText(ST_ShortestLine('LINESTRING(1 1, 1 10)'::geometry,
> 'LINESTRING(2 5, 10 5)'::geometry));
> returns 'LINESTRING(1 5, 2 5)'::geometry
>
>  geography type calculations is of course another story.
>
>
>  HTH
>
>  Nicklas
>
>
>
>
> 2013-10-18 Peter Hopfgartner wrote:
>
> I took it for granted, that ST_Distance between two two dimensional
> >geometries followes the definition of
> >
> >dist(A, B) = inf(d(a,b)), where a is an arbitrary point in set A and b
> >an arbitrary point in set B and d() is the euclidean distance
> >
> >For some reason I'm now wondering if my assumption is true.
> >
> >Thanks for your patience,
> >
> >Peter
> >
> >--
> >Peter Hopfgartner
> >R3 GIS
> >
> >web : http://www.r3-gis.com
> >
> >_______________________________________________
> >postgis-users mailing list
> >postgis-users at lists.osgeo.org
> >http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> >
> >
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131018/959f6378/attachment.html>


More information about the postgis-users mailing list