Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In postgis 1.5 for the below given query the answer is 1540651.62674101 meters ,

SELECT ST_Length(ST_GeomFromText('LINESTRING(77.83042478941326 
9.98463896136159,78.03469506809812 23.90398909552571 )',4326),true);

but in google earth the same line gives 1538923 meters in its properties, around 0.1% error between the two readings.

Which one is accurate, if Google earth reading is accurate, how to get it in postgis1.5 ...

any idea...

please help.

share|improve this question
According to, ST_Length(Geometry) should return degrees in your example. There is no ST_Length(Geometry,boolean) in PostGIS 1.5. – underdark May 24 '11 at 9:20
There could be difference in the coordinate systems parameters between the two...which would lead to the disparity. – ujjwalesri May 24 '11 at 9:23

Apart from, as @underdark says ST_Length() returns a cartesian distance between the two points which in an unprojected CS is meaningless in this case, I would go with the answer you get from PostGIS. Google Earth uses a spherical globe, whereas the WGS84 globe is a spheroid - it is slightly squashed at the poles. Over short distances, there won't be much difference between the two, but at 1500km, there will be a more significant difference, more so as your line deviates from east/west.

Also, because the WGS84 spheroid is just an idealised model of the earth, don't be fooled by the precision of the result, the accuracy is going to be much lower. If you used WGS84 to guide a missile over that sort of distance, you're likely to hit the next street over.

You can get the same result as GE in PostGIS should you want, by using ST_Distance_Sphere() this is useful if you're using PostGIS as a data provider to GE.

Running your example on my PostGIS 1.5 system, I get:

SELECT ST_Distance_Sphere(
ST_GeomFromText('POINT(77.83042478941326 9.98463896136159)',4326),
ST_GeomFromText('POINT(78.03469506809812 23.90398909552571)',4326));


SELECT ST_Distance_Spheroid(
ST_GeomFromText('POINT(77.83042478941326 9.98463896136159)',4326),
ST_GeomFromText('POINT(78.03469506809812 23.90398909552571)',4326),
'SPHEROID["WGS 84",6378137,298.257223563]');

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.