rspatial / geosphere

R geosphere package
GNU General Public License v3.0
34 stars 7 forks source link

Change sequence of spatial coordinates/ adding examples #15

Closed TheOysterPrince closed 4 months ago

TheOysterPrince commented 4 months ago

Hi, I have just been looking for a solution to an inaccuracy problem while using the distHaversine() function of the geosphere package.

However, I should have just read the documentation properly. My mistake was the wrong order of the spatial points, since I assumed the package is using the offical standard (latitude/ longitude) introduced by the International Maritime Organization and used by various applications.

short and good explanation of the background: What goes first Longitude or Latitude?

It would be great if the order could be adjusted, as it is easy to get confused when working with spatial coordinates and just causes havoc.

Alternatively, the examples in the documentation should be adapted and made more comprehensive so that the spatial point structure is made clearer.

rhijmans commented 4 months ago

The order is arbitrary. longitude/latitude order matches x/y on (most) maps. I also believe this is the de-facto standard in spatial data analysis. I cannot change this in geosphere, as that would break every script that depends on it. But, yes, the order is arbitrary, and this is a common source of error. I will keep this in mind when editing the documentation.