[postgis] distance(geometry,geometry) function

Timothy H. Keitt tklistaddr at keittlab.bio.sunysb.edu
Tue Jul 24 11:58:21 PDT 2001

Dave Blasby wrote:

>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?
Not in general, no.  This is all made more complex by the fact that 
postgis points and polygons are not seperate SQL types, but are instead 
mixed together within a single column of type "geometry", so you have to 
make your function accept all types of geometry objects.  I'm curious 
why you chose this path instead of making each geometric type a 
different SQL type as with the built-in postgresql geometry types?  Come 
to think of it, I'm not sure what postgis provides that the built-in 
types don't (except maybe much faster queries?).

I agree with Frank that a quick wrapper around PROJ.4 would be a good 
short-term solution for handling datum projections.


Timothy H. Keitt
Department of Ecology and Evolution
State University of New York at Stony Brook
Stony Brook, New York 11794 USA
Phone: 631-632-1101, FAX: 631-632-7626

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Small business owners...
Tell us what you think! http://promo2.yahoo.com/sbin/Yahoo!_BusinessNewsletter/survey.cgi

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/ 

More information about the postgis-users mailing list