qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.66k stars 3.01k forks source link

Mirrored display on Southing-Westing CRS #56802

Open jjimenezshaw opened 8 months ago

jjimenezshaw commented 8 months ago

What is the bug or the crash?

When selecting the CRS EPSG:5513 (S-JTSK / Krovak) (area "Czechia; Slovakia.") the images appear mirrored and rotated 90deg. EPSG:5513 has axis order as "southing-westing" (left-handed) Screenshot from 2024-03-11 10-40-18

This is not happening with other CRSs that are also left-handed, like EPSG:3044 "northing-easting" Screenshot from 2024-03-11 10-40-36

Neither with other that are "westing-southing" (right-handed), like EPSG:22281 in South Africa (here the image is rotated 180deg, but not mirrored) Screenshot from 2024-03-11 10-41-23

I think the image should not be mirrored, and also be consistent in behaviour among different axis orderings. (if northing-easting system is not rotating 90deg, southing-westing shouldn't. Either 0 or 180. 180 would be consistent with westing-southing used in South Africa)

Steps to reproduce the issue

  1. Add openstreetmap layer
  2. Select CRS EPSG:5513

Versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

QGIS version | 3.36.0-Maidenhead | QGIS code revision | 09951dc0acf -- | -- | -- | -- Qt version | 5.15.3 Python version | 3.10.12 GDAL/OGR version | 3.4.1 PROJ version | 8.2.1 EPSG Registry database version | v10.041 (2021-12-03) GEOS version | 3.10.2-CAPI-1.16.0 SQLite version | 3.37.2 PDAL version | 2.3.0 PostgreSQL client version | 14.10 (Ubuntu 14.10-0ubuntu0.22.04.1) SpatiaLite version | 5.0.1 QWT version | 6.1.4 QScintilla2 version | 2.11.6 OS version | Ubuntu 22.04.4 LTS   |   |   |   Active Python plugins reloader | 0.1 FreehandRasterGeoreferencer | 0.8.3 valuetool | 3.0.19 db_manager | 0.1.20 processing | 2.12.99 grassprovider | 2.12.99 MetaSearch | 0.3.6 QGIS version 3.36.0-Maidenhead QGIS code revision [09951dc0acf](https://github.com/qgis/QGIS/commit/09951dc0acf) Qt version 5.15.3 Python version 3.10.12 GDAL/OGR version 3.4.1 PROJ version 8.2.1 EPSG Registry database version v10.041 (2021-12-03) GEOS version 3.10.2-CAPI-1.16.0 SQLite version 3.37.2 PDAL version 2.3.0 PostgreSQL client version 14.10 (Ubuntu 14.10-0ubuntu0.22.04.1) SpatiaLite version 5.0.1 QWT version 6.1.4 QScintilla2 version 2.11.6 OS version Ubuntu 22.04.4 LTS Active Python plugins reloader 0.1 FreehandRasterGeoreferencer 0.8.3 valuetool 3.0.19 db_manager 0.1.20 processing 2.12.99 grassprovider 2.12.99 MetaSearch 0.3.6 ### Supported QGIS version - [x] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule). ### New profile - [ ] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles) ### Additional context _No response_
rouault commented 8 months ago

Part of this is common with https://github.com/qgis/QGIS/issues/32391

I believe this basically boils down to the PROJ's proj_normalize_for_visualization only taking into account longitude/latitude, latitude/longitude, easting/northing, northing/easting, but none of the other "funky" axis order and orientations

jjimenezshaw commented 8 months ago

Now I understand where proj_normalize_for_visualization is used. Thanks.

Yes, the function

static bool mustAxisOrderBeSwitchedForVisualizationInternal(
    const std::vector<cs::CoordinateSystemAxisNNPtr> &axisList) {
    const auto &dir0 = axisList[0]->direction();
    const auto &dir1 = axisList[1]->direction();
    if (&dir0 == &cs::AxisDirection::NORTH &&
        &dir1 == &cs::AxisDirection::EAST) {
        return true;
    }
....

should also check for South-West. East-South and West-North are also left-handed, but converting them into South-East and North-West would rotate the image 90 deg.

I searched a bit, and found these examples:

e-n: many n-w: https://spatialreference.org/ref/epsg/3173/ (most in Greenland and Faroe) w-s: https://spatialreference.org/ref/epsg/22281/ (all in South Africa, Lesotho and Namibia) s-e: -none-

n-e: many w-n: only https://spatialreference.org/ref/epsg/3052/ and https://spatialreference.org/ref/epsg/3053/ (and many in iau_2015) s-w: https://spatialreference.org/ref/epsg/5513/ (most in Czechia and Slovakia) e-s: -none-

Maybe the simpler action would be make left-handed to right-handed, leaving those few that are in n-w or w-n rotated 90 deg. But at least they are not mirrored.

Regarding having North up or down when axis is Southing... That I think is another topic.