[postgis] Distance on a Spheroid

Dave Blasby dblasby at refractions.net
Wed Jun 27 14:50:16 PDT 2001


We had requests to do length calculations on a spheroid.  They are now
available, thanks to Mark Sondheim and David Skae at Geographic Data BC.


New type, SPHEROID.  Specify in OpenGIS WKT format.

SPHEROID("name",<semi-major axis>, <inverse flattening)

ie. SPHEROID("GRS_1980",6378137,298.257222101)

as per the WKT spec, you can use "[]" instead of "()"

If your geometry is in LAT/LONG format you can use:

length3d_ellipsoid(GEOMETRY, SPHEROID)
	-- find the length of all the LINESTRINGs in GEOMETRY

length_ellipsoid  (GEOMETRY, SPHEROID)
	-- find the length of all the LINESTRINGs in GEOMETRY, ignoring
		Z values.

for example,
select length_spheroid('LINESTRING(-126 49,-126 49.011096139863)',
'SPHEROID["GRS_1980",6378137,298.257222101]');

	gives 1234.000

dave
ps. I'm using the X coordinate to mean Longitude and Y to mean Lattitude

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