From http://postgis.net/workshops/postgis-intro/geography.html, I can understand how poles might be an issue but how do datelines create problems?

The distance between points get larger as problem areas like the poles or the international dateline are approached.


It depends on whether you are storing your features as geometry or geography data type and the projection in the former case. If you are using geography or have a projection that puts the dateline in the middle of the map, then there is no problem with calculating distance. However, if you are using geometry data type with most projections (where the dateline is at the east and west extremes of the projection extent) then measuring across the dateline will give unexpected results because the measurement will follow Cartesian space and not go beyond the extents of the projection but remain within its bounds. For example, if you want to measure from locations at the equivalents of 179.9 degrees to -179.9 degrees then the measurement would go west to east (the long way) and not east to west (the more direct distance).

So, to summarize, distance measurement is not always a problem across the ante-meridian (which is actually where the issue lies and not the dateline, which is a similar but different thing) but can be if you are not careful and explicit about your requirements.

In PostGIS you can just cast geometry to geography on the fly though. See the linked documentation, which contains more information on poles and dateline (ante-meridian).

  • 1
    it would be better to use the term anti-meridian rather than dateline as the data line is a human construct and wiggles to avoid land and changes position from time to time, – Ian Turton May 29 '17 at 10:15
  • +1 Yes, exactly - hence my comment in the second paragraph – MappaGnosis May 29 '17 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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