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

Paul Ramsey pramsey at cleverelephant.ca
Fri Oct 18 10:43:50 PDT 2013


Except when one or more of the geometries includes circular arcs (v 2.1+)

P

On Fri, Oct 18, 2013 at 6:39 AM, Nicklas Avén
<nicklas.aven at jordogskog.no> wrote:
> 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


More information about the postgis-users mailing list