Note that there are some explanatory texts on larger screens.

plurals
  1. PODifferent calculations between ST_Transform and CoordTransform that involves presition
    primarykey
    data
    text
    <p>I am working with GeoDjango and Postgis, and doing transformation on a point from 4326 to 24877, when I have checked the result, it is not the same</p> <p><strong>My values are:</strong></p> <pre><code>Latitude -16.42238172128686 Longitude -71.47541752550751 </code></pre> <p><img src="https://i.stack.imgur.com/b1j1b.jpg" alt="Initial position"></p> <p><strong>Using long lat as x, y coord</strong></p> <pre><code>In [63]: pnt = Point(-71.47541752550751, -16.42238172128686, srid=4326) In [64]: pnt.transform(CoordTransform(SpatialReference(4326), SpatialReference(24877))) In [65]: pnt.x, pnt.y, pnt.srid Out[65]: (1521142.247877425, 8160547.8770980425, 24877) </code></pre> <p><strong>Inverse</strong></p> <pre><code>In [66]: pnt = Point( 1521142.247877425,8160547.8770980425, srid=24877 ) In [67]: pnt.transform(CoordTransform(SpatialReference(24877), SpatialReference(4326))) In [68]: pnt.x, pnt.y, pnt.srid Out[68]: (-71.47541753138003, -16.42238165040434, 4326) </code></pre> <p><img src="https://i.stack.imgur.com/HYdjc.jpg" alt="Position after calculus"></p> <p><strong>SQL on Postgres</strong></p> <pre><code>SELECT ST_AsText(ST_Transform(ST_SetSRID(ST_MakePoint(-71.47541752550751, -16.42238172128686), 4326),24877)) POINT(1520903.86571082 8160169.90886929) </code></pre> <p><strong>Taking data from postgis results</strong></p> <pre><code>In [69]: pgs = Point(1520903.86571082, 8160169.90886929, srid=24877) In [70]: pgs.transform(CoordTransform(SpatialReference(24877), SpatialReference(4326))) In [71]: pgs.x, pnt.y, pgs.srid Out[71]: (-71.47745375612124, -16.42238165040434, 4326) </code></pre> <p><img src="https://i.stack.imgur.com/2UVIb.jpg" alt="Image on sql results"></p> <p>As you could see there is a difference between geodjango and postgres, on at least 300 meters, and that means different places</p> <p>After reading and asking on some forums and chats, I have found that this is related to presition, I was asking more about it on internet, as a newbie on this topic, this is getting some heard to fin. </p> <p>I am looking for information that give me enough knowledge for continue working on it, for example:</p> <ol> <li>The right way on do that</li> <li>The reason on this difference</li> <li>how many meters are the difference between systems or the right way on calculate that</li> <li>how to validate this positions</li> <li>what is the best way on work this information</li> </ol>
    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.
 

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