grass icon indicating copy to clipboard operation
grass copied to clipboard

[Bug] (-180°, 0°) == (180°, 0°) in (east, north) in epsg:4326?

Open HuidaeCho opened this issue 4 years ago • 1 comments

Describe the bug Is east=-180°, north=0° the same as east=180°, north=0° in epsg:4326? Yes, they are the same point on Earth, but then shouldn't east=-180°, north=90° be the same as east=180°, north=90°? I tried to draw a bounding box (-180°, 90°) - (-180°, 0°) - (180°, 0°) - (180°, 90°), which is the entire northern hemisphere, using this command:

v.in.ascii -n format=standard input=- output=tmp <<EOT
L 5
-180 90
-180 0
180 0
180 90
-180 90
EOT

This is the output map (red lines): image

The top-left vertex is (-180, 90), bottom-left (-180, 0), again bottom-left (180, 0) (expected it to be on the right side on the equator), top-right (180, 90), and top-left (-180, 90).

The same thing happens on the southern hemisphere.

Is it a feature or a bug? How can I draw a rectangle that exactly covers one hemisphere?

To Reproduce Steps to reproduce the behavior:

  1. Go to an epsg:4326 mapset
  2. Run this command:
v.in.ascii -n format=standard input=- output=tmp <<EOT
L 5
-180 90
-180 0
180 0
180 90
-180 90
EOT
  1. Display tmp
  2. See error

Expected behavior A rectangle that covers the entire northern hemisphere.

Screenshots

System description (please complete the following information):

  • Operating System: Linux
  • GRASS GIS version: master

Additional context Add any other context about the problem here.

HuidaeCho avatar Jun 19 '21 15:06 HuidaeCho

The GRASS display does longitude wrapping for geographic projections, so drawing a line from -180, 0 to 180, 0 can create unexpected results because these are the same points on earth. If you add a few stopover points, you get a proper box, e.g. with:

v.in.ascii -n format=standard input=- output=tmp <<EOT
L 11
-180 90
-180 0
-90 0
0 0
90 0
180 0
180 90
90 90
0 90
-90 90
-180 90
EOT

metzm avatar Nov 16 '25 16:11 metzm