-
Notifications
You must be signed in to change notification settings - Fork 75
Recalculate ellipsoid elevation to orthometric #4210
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
Changes from all commits
1573f1c
a4bc2d2
131f97b
2383487
ca5525f
ed765fb
f8817a3
3666aa6
661e3d7
a7c4420
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -476,7 +476,7 @@ QString InputUtils::geometryLengthAsString( const QgsGeometry &geometry ) | |
| { | ||
| QgsDistanceArea distanceArea; | ||
| distanceArea.setEllipsoid( QStringLiteral( "WGS84" ) ); | ||
| distanceArea.setSourceCrs( QgsCoordinateReferenceSystem::fromEpsgId( 4326 ), QgsCoordinateTransformContext() ); | ||
| distanceArea.setSourceCrs( PositionKit::positionCrs2D(), QgsCoordinateTransformContext() ); | ||
|
|
||
| qreal length = distanceArea.measureLength( geometry ); | ||
|
|
||
|
|
@@ -879,32 +879,30 @@ QgsPoint InputUtils::transformPoint( const QgsCoordinateReferenceSystem &srcCrs, | |
| // QGIS would convert them to a valid (0, 0) points | ||
| if ( srcPoint.isEmpty() ) | ||
| { | ||
| return QgsPoint(); | ||
| return {}; | ||
| } | ||
|
|
||
| try | ||
| { | ||
| QgsCoordinateTransform ct( srcCrs, destCrs, context ); | ||
| const QgsCoordinateTransform ct( srcCrs, destCrs, context ); | ||
| if ( ct.isValid() ) | ||
| { | ||
| if ( !ct.isShortCircuited() ) | ||
| { | ||
| const QgsPointXY transformed = ct.transform( srcPoint.x(), srcPoint.y() ); | ||
| const QgsPoint pt( transformed.x(), transformed.y(), srcPoint.z(), srcPoint.m() ); | ||
| const QgsVector3D transformed = ct.transform( QgsVector3D( srcPoint.x(), srcPoint.y(), srcPoint.z() ) ); | ||
| const QgsPoint pt( transformed.x(), transformed.y(), transformed.z(), srcPoint.m() ); | ||
| return pt; | ||
| } | ||
| else | ||
| { | ||
| return srcPoint; | ||
| } | ||
|
|
||
| return srcPoint; | ||
| } | ||
| } | ||
| catch ( QgsCsException &cse ) | ||
| { | ||
| Q_UNUSED( cse ) | ||
| } | ||
|
|
||
| return QgsPoint(); | ||
| return {}; | ||
| } | ||
|
|
||
| QPointF InputUtils::transformPointToScreenCoordinates( const QgsCoordinateReferenceSystem &srcCrs, InputMapSettings *mapSettings, const QgsPoint &srcPoint ) | ||
|
|
@@ -953,11 +951,10 @@ QgsPoint InputUtils::mapPointToGps( QPointF mapPosition, InputMapSettings *mapSe | |
| return QgsPoint(); | ||
|
|
||
| QgsPoint positionMapCrs = mapSettings->screenToCoordinate( mapPosition ); | ||
| QgsCoordinateReferenceSystem crsGPS = coordinateReferenceSystemFromEpsgId( 4326 ); | ||
|
|
||
| const QgsPointXY transformedXY = transformPoint( | ||
| mapSettings->destinationCrs(), | ||
| crsGPS, | ||
| PositionKit::positionCrs2D(), | ||
| QgsCoordinateTransformContext(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not directly relevant to this PR, but we should not use empty QgsCoordinateTransformContext() - we should use coordinate transform context from the active project everywhere, to avoid some subtle transformation errors (e.g. when project admin picks a non-default transform). Worth checking elsewhere too!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is worth to do as a separate PR and go through the whole code base. I'll create a new issue for this and try to tackle it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see #4221 |
||
| positionMapCrs | ||
| ); | ||
|
|
@@ -1715,7 +1712,7 @@ qreal InputUtils::distanceBetweenGpsAndFeature( QgsPoint gpsPosition, const Feat | |
|
|
||
| // Transform gps position to map CRS | ||
| QgsPointXY transformedPosition = transformPoint( | ||
| coordinateReferenceSystemFromEpsgId( 4326 ), | ||
| PositionKit::positionCrs3D(), | ||
| mapSettings->destinationCrs(), | ||
| mapSettings->transformContext(), | ||
| gpsPosition | ||
|
|
@@ -1763,7 +1760,7 @@ qreal InputUtils::angleBetweenGpsAndFeature( QgsPoint gpsPoint, const FeatureLay | |
|
|
||
| // Transform gps position to map CRS | ||
| QgsPointXY transformedPosition = transformPoint( | ||
| coordinateReferenceSystemFromEpsgId( 4326 ), | ||
| PositionKit::positionCrs3D(), | ||
| mapSettings->destinationCrs(), | ||
| mapSettings->transformContext(), | ||
| gpsPoint | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.