New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[api] Add QgsProject::crs3D #57107
[api] Add QgsProject::crs3D #57107
Conversation
@rouault @wonder-sk as previously discussed |
@nyalldawson is this going to work if 3D Geographic (e.g. EPSG:4979) or Geocentric (e.g. EPSG:4978) CRS is set as the project CRS? Or is support for that out of scope for now? |
It works fine for this situation: |
@wonder-sk I've applied some more related refinements here |
src/core/project/qgsproject.cpp
Outdated
case Qgis::CrsType::Unknown: | ||
case Qgis::CrsType::Geodetic: | ||
case Qgis::CrsType::Geographic2d: | ||
case Qgis::CrsType::Projected: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some Projected CRS might already be 3D. You should probably check the axis count
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rouault !
Returns the CRS to use for the project when transforming 3D data, or when z/elevation value handling is important. The returned CRS will take into account verticalCrs(), e.g. by returning a compound CRS consisting of crs() + verticalCrs(). This method may still return a 2D CRS, e.g in the case that crs() is a 2D CRS and no verticalCrs() has been set for the project. I.E. It is NOT guaranteed that the returned CRS will actually be a 3D CRS, but rather it is guaranteed that the returned CRS is **ALWAYS** the most appropriate CRS to use when handling 3D data.
Report proj error when compound crs cannot be created
or geocentric Following https://docs.ogc.org/as/18-005r5/18-005r5.html#34 it is not a valid combination to create a compound crs from these types
Can be used to test if a crs contains a vertical axis
Returns the CRS to use for the project when transforming 3D data, or when z/elevation value handling is important.
The returned CRS will take into account verticalCrs(), e.g. by returning a compound CRS consisting of crs() + verticalCrs().
This method may still return a 2D CRS, e.g in the case that crs() is a 2D CRS and no verticalCrs() has been set for the project. I.E. It is NOT guaranteed that the returned CRS will actually be a 3D CRS, but rather it is guaranteed that the returned CRS is ALWAYS the most appropriate CRS to use when handling 3D data.
Refs discussion in #56791, qgis/QGIS-Enhancement-Proposals#267