Skip to content
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

Reprojection on the fly doesn't work if layers have different projections #12627

Closed
qgib opened this issue Mar 20, 2010 · 1 comment
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Mar 20, 2010

Author Name: sowelu - (sowelu -)
Original Redmine Issue: 2567

Redmine category:map_canvas
Assignee: nobody -


I have found a problem with vectors being misplaced if there are multiple layers with different projections. I would expect that if you have On The Fly Reprojection set and a valid CRS for each layer, then they should each be reprojected correctly onto the map.

Looking through the code it appears that the problem is that all layers use the same [[QgsRenderContext]] as this is a member of [[QqsMapRenderer]]. The [[QgsMapRenderer]] loops through each layer calling its draw() function and passing the same [[QgsRenderContext]] to each layer. The [[QgsCoordinateTransform]] is a member of the [[QgsRenderContext]] and so doesn't change as the layer list is iterated. As this contains the data and functions to reproject points then the same transform gets applied to each layer (not sure how it is defined, maybe that of the first layer?), when in fact each layer may require different co-ordinate transforms as they may have different [[SourceCRS]].

It may be better to store the [[QgsCoordinateTransform]] in the layer, rather than the [[QgsRenderContext]].

Attached are some files to illustrate. The [[RenderContextTest]].qgs project will set the map to AGD84 Zone 55 and load two shapefiles. The shapefiles each contain the same line with the same co-ordinates (ie the easting and northing numbers are the same) but they are in different projections - AGD84 Zone 55 and GDA94 Zone 55. With On The Fly reprojection turned off they overlay each other. With it turned on they should be shifted by 200m in a NE-SW direction (tested with [[MapInfo]]) - instead they remain the same (well almost, there may also be a problem with confusing AGD84 and AGD66 indicated in the debug messages).

I have compiled trunk (13071M) with Debug on and there does not appear to be a problem with invalid CRS.

This is the most I have examined the QGIS code, so please correct me if I have misunderstood it. Even if I have misunderstood the problem of not reprojecting remains.

Regards,

Roland


@qgib
Copy link
Contributor Author

qgib commented Mar 24, 2010

Author Name: sowelu - (sowelu -)


ah, I see the [[QgsCoordinateTransform]] is updated in the [[QgsRenderContext]] before drawing each layer. I still have a problem with OTF reprojections between AGD84 and GDA94, but I will close this ticket as it is wrong and investigate further.

Roland


  • resolution was changed from to invalid
  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering labels May 24, 2019
@qgib qgib added this to the Version 1.5.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering
Projects
None yet
Development

No branches or pull requests

1 participant