7

I work with WGS-84 coordinates and, most of the time, my map display (luciadmap) is in Mercator projection.

My client is surprised to see that, for a rectangular geometry:

  • the line between the 2 upper points is not straight
  • the line between the 2 lower points is not straight

N.B: Of course, the 2 upper points have the same latitude, and the 2 lower points have the same latitude.

My client expects to see only straight lines in Mercator. I think that is a wrong expectation. From my point of view, when a geographical zone is drawn on the map, it's sides should be linked by "great-circle" paths (arcs), not rhumb-lines.

Furthermore, all my geographical zones are stored in a Postgres+PostGis database. PostGis function are used to determine if some other geometries intersect with my zones. If I draw my zones using rhumb-lines and intersect using postGis, I fear that some geometries will appear completely outside of my zone. That would seem wrong!

Do you know how PostGis computes it's intersections? For you, how should geometrical zones be represented on a map?

2
  • I dont know who is right, but maybe your client has this expectation after reading the rhumb line article on wikipedia where it says that they are straight lines on mercator map. Sep 17, 2014 at 18:02
  • Yes, rhumb-lines are straight on Mercator and great-circles are straight on a gnomonic.
    – Martin F
    Sep 2, 2015 at 22:37

1 Answer 1

7

PostGIS computes its intersections (and distances (and areas)) differently depending on your column type.

  • if the type is "geometry" the assumption is you want to work on a plane, so you get "straight line" distances / intersection tests
  • if the type is "geography" the assumption is you want to work on a sphere, so you get great circle distances / tests

Similarly, ST_Segmentize does different things for geometry and geography. For geometry, additional vertices are added along the straight lines between existing vertices; for geography, they are added along the great circle lines.

If the application is working in a large enough area that the differences between the sphere and cartesian spaces are visible, then my opinion is you should use geography and great circles. The most important thing though, is that what the users sees is what gets used for calculations, so if they are getting straight lines on the screen, that's what should be used for calculations, and vice versa.

4
  • Does the different approach to geometry/geography types hold true for other databases as well? (I had a professor who stated they could be used perfectly interchangeably, but I wouldn't be surprised if he was incorrect about that.)
    – Erica
    Sep 17, 2014 at 17:38
  • PostGIS behaviour is basically the same idea as SQL Server implements. Geometry as cartesian, geography as spherical. Oracle Spatial has only one type, sdo_geometry, and invisibly changes strategies based on the CRS. Sep 17, 2014 at 21:37
  • To summarize, if all my geometries are created using the SRID 4326 then PostGis will always use orthodromy to calculate the distances and intersections?
    – Pigelvy
    Sep 18, 2014 at 8:53
  • If they are all in the "geometry" column type, then yes, regardless of SRID the assumption is you're working in a cartesian space with straight-line interpolation. Sep 18, 2014 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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