# [postgis] distance(geometry,geometry) function

Dave Blasby dblasby at refractions.net
Tue Jul 24 09:12:48 PDT 2001

```> I assume you mean euclidean distance.  A lot of us keep our locations in
> geodetic coordinates.  It would be nice if geometries could reference a
> particular datum so these things would be handled transparently.
>  (Postgis is nonetheless a very exciting development.)

Yes, these are euclidean distances.  The calculations in geodetic
coordinates are complex.

We have a function that, given a spheroid and 2 geodetic points, will
calculate the distance between them.  In order to do distance() in
generality, I need to be able to;

1. Given a spheroid and the points A, B, and C.  A-B define a line in
geodetic space (a great circle).  Find the minimum distance (also a
great circle) between the line AB and C.

2. Given a spheroid and the points A, B and U, V.  A-B and U-V define
lines in geodetic space.  Tell me if they intersect or the minimum
distance between then.

3. Given a spherioid, the point A, and the polygon P tell me if point A
is inside the polygon P.

Then I'd need to dust off my spherical geometry and make sure my
euclidean assumptions will hold on an ellipsoid.

Does anyone know how to calculate these things?

dave

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

```