Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>PostgreSQL does not factor in altitude when calculating distances. It is all done in a planar surface.</p> <p>Most of database spatial packages will not take this into account, altought, if your point is 3d, i.e., has a Z coordinate that might happend.</p> <p>I don´t have PostgreSQL in this machine, but try this.</p> <p>SELECT ST_DISTANCE(ST_POINT(0,0,10),ST_POINT(0,0,0));</p> <p>It´s fairly easy to know if it is taking into account your Z value, since the return should be > 0; If that turns out to be true, just create Z aware features, and you will be successfull.</p> <p>What SQL SERVER 2008, for example, takes into account when calculating distances, is the position of a Geography feature in a sphere. Geometry features in SQL SERVER will always use planar calculations.</p> <p><strong>EDIT: checked this in PostGIS manual</strong></p> <p>For Z aware points you must use the ST_MakePoint function. It takes up to 4 arguments (X Y Z and M). St_POINT only takes two (X Y)</p> <p><a href="http://postgis.refractions.net/documentation/manual-1.4/ST_Distance.html" rel="nofollow noreferrer">http://postgis.refractions.net/documentation/manual-1.4/ST_Distance.html</a> ST_DISTANCE = 2D calculations</p> <p>ST_DISTANCE_SPHERE documentation (takes in account a fixed sphere for calculations - aka not planar) <a href="http://postgis.refractions.net/documentation/manual-1.4/ST_Distance_Sphere.html" rel="nofollow noreferrer">http://postgis.refractions.net/documentation/manual-1.4/ST_Distance_Sphere.html</a></p> <p>ST_DISTANCE_SPHEROID documentation (takes into account a choosen spheroid for your calculations) <a href="http://postgis.refractions.net/documentation/manual-1.4/ST_Distance_Spheroid.html" rel="nofollow noreferrer">http://postgis.refractions.net/documentation/manual-1.4/ST_Distance_Spheroid.html</a></p> <p>ST_POINT documentation <a href="http://postgis.refractions.net/documentation/manual-1.4/ST_Point.html" rel="nofollow noreferrer">http://postgis.refractions.net/documentation/manual-1.4/ST_Point.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload