Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/iso19111/crs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,14 @@ 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) {
if ((&dir0 == &cs::AxisDirection::NORTH &&
&dir1 == &cs::AxisDirection::EAST) ||
(&dir0 == &cs::AxisDirection::EAST &&
&dir1 == &cs::AxisDirection::SOUTH) ||
(&dir0 == &cs::AxisDirection::SOUTH &&
&dir1 == &cs::AxisDirection::WEST) ||
(&dir0 == &cs::AxisDirection::WEST &&
&dir1 == &cs::AxisDirection::NORTH)) {
Comment on lines +875 to +880
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that just switching the axis is enough for those 3 coordinate system. We should also presumably transform southing to northing, westing to easting, and make sure the final order is easting, northing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is also changing other problem, that westing-southing is displayed in QGIS with Antartica at the top. In that case moving up in the screen will make the coordinates decrease. Is that normal?

I do not mean that it should not be changed (well, I got used to it in South Africa). But the initial problem in QGIS was the mirroring effect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case moving up in the screen will make the coordinates decrease. Is that normal?

I guess so.

I believe all those coordinate systems should have easting,northing axis order after normalize_for_visualization. The native orders are just conventions to avoid specifying negative values, or other esoteric reasons, but ultimately you want your map with increasing eastings towards the right of the screen, and increasing northings towards the top of the screen

Maybe @thareUSGS can confirm for planetary CRS how maps in a CRS like IAU_2015:19901 "Mercury (2015) / Ographic" which has northing,westing should be displayed. I presume this should be transformed as easting,northing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe all those coordinate systems should have easting,northing axis order after normalize_for_visualization. The native orders are just conventions to avoid specifying negative values, or other esoteric reasons, but ultimately you want your map with increasing eastings towards the right of the screen, and increasing northings towards the top of the screen

I have been thinking about this a bit more. Currently in QGIS (and also with this PR), using a WSU system, easting/westing is increasing towards the right of the screen, and northing/southing is increasing towards the top of the screen (for that reason Antarctica is at the top). I think in PROJ we cannot do anything to avoid it.

If QGIS wants to display Antarctica at the bottom with such CRS, it is something to be done in the display, QGIS.

return true;
}

Expand Down
23 changes: 23 additions & 0 deletions test/unit/test_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4456,6 +4456,29 @@ TEST_F(CApi, proj_normalize_for_visualization_on_crs) {

// ---------------------------------------------------------------------------

TEST_F(CApi, proj_normalize_for_visualization_on_crs_westing_southing) {

auto P = proj_create(m_ctxt, "EPSG:5513");
ObjectKeeper keeper_P(P);
ASSERT_NE(P, nullptr);
auto Pnormalized = proj_normalize_for_visualization(m_ctxt, P);
ObjectKeeper keeper_Pnormalized(Pnormalized);
ASSERT_NE(Pnormalized, nullptr);
EXPECT_EQ(proj_get_id_code(Pnormalized, 0), nullptr);

auto cs = proj_crs_get_coordinate_system(m_ctxt, Pnormalized);
ASSERT_NE(cs, nullptr);
ObjectKeeper keeperCs(cs);

const char *name = nullptr;
ASSERT_TRUE(proj_cs_get_axis_info(m_ctxt, cs, 0, &name, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr));
ASSERT_NE(name, nullptr);
EXPECT_EQ(std::string(name), "Westing");
}

// ---------------------------------------------------------------------------

TEST_F(CApi, proj_coordoperation_create_inverse) {

auto P = proj_create(
Expand Down
Loading