-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix lots of georeferencer issues #47141
Conversation
Unsure if this can be helpful but there were some exchanges on #46415 The renaming of things is welcome. |
a2c3cbd
to
0f44c97
Compare
@roya0045 @gioman I'd love testing of this branch and confirmation that you don't see any remaining issues (aside from those described in #46941) The size of these changes makes me nervous, but at the same time the georeferencer is quite broken in master/3.22 so we don't have any choice but to merge and backport and hope that we can test sufficiently prior to release...! |
@nyalldawson I tested the windows artifact. The georef operation seems to get stuck (progress bar moves, but like 1% every 5 minutes) and GCP points are a no show in georef map window: I'm using the data and configs from here #46901 (comment) A few days back I tested the artifact for a now closed patch #46524 (comment) and worked ok (even if I understand that was not the right fix). |
@nyalldawson GCP did show up when I double clicked somwhere in the GCP table, but that made the image to georef disappear |
@gioman I suspect the points file there is invalid, and has map coordinates for the raster instead of pixels. Creation of the gcp file is fixed here, but I'm not sure we can "auto repair" invalid ones... |
@nyalldawson ok, I'll try with another dataset. |
It's always possible that I've made the wrong choice here, and that we should be storing the source coordinates instead of pixels in the gcp file! I'm not sure what the original intention was, but we always interpret these values as pixels and the heading states "pixelX" so that's why I went that way. But maybe the heading is what's wrong... 😳 Thinking about a future time when we support vector file georeferencing, it no longer would make sense to use pixels here. So in short... I'm 50/50, and would value any insights anyone has! |
@nyalldawson tested again from scratch. The operation seems to work ok. Anyway I have a few observations I will leave here. As a start; I georeferenced a jpg using a project that had CRS 3763 and picking the GCP on the canvas. In georef configs I choose 3763 as target CRS. The output is added to QGIS with "unknown" CRS (but in the right place). |
@nyalldawson after all this seems to be the only outstanding issue. I tried also to georef to WGS84 and the resulting layer shows with "invalid" projection. |
IMO the coordinates should be the good things to store, as ungeoreferenced images also have their own 'coordinates' and the pixel values are quite specific to a file, but the intent is to move one point to another and from one projection to another. The pixels are just where the point is for a given raster. I could see uses where there is a single gcp files to georeference multiple images, even if the points are out of the image the transformation should still be usable. IE if you have a lot of overlapping images, do a few generic points and then use the same gcps to georeference everything (if they are already georeferenced, from a non-referenced state this wouldn't work). But as long as it works fine I don't mind it. But I agree that the requirement of this requires juggling with a lot of 'domains' which can be confusing (raster pixels, pts crs, origin, destinations, destination crs, etc.) |
@gioman Thanks for testing! I wouldn't have much time at work or out of it to test it in depth as you did, even with a few days of delay. |
I think I'm leaning that way too (especially given the future vector consideration). If we go that we we'll definitely need to fix the headers of the .points files though, as they are misleading right now. I'll see what's involved in making this switch tomorrow (and will also re-test with the raster/points from that ticket as a result) |
👍 Sure, let me know if I can be of assistance, though it might not be too timely. |
0f44c97
to
6dd22b3
Compare
I've re-worked this so that we ALWAYS use source coordinates when saving/loading gcp points files. This fixes the issue described in #46901 (that file works without issue now). I'd love some more testing of this branch before we merge, if you've time! (Also added a bunch of extra paper cut fixes to this branch, tests, cleaner code, ...) |
I'll try to do some tests later today, thanks for doing this! |
@nyalldawson I see weird things. First case, canvas is in 3857, georef configured to 3763. The destination Y parameter shows with no decimals, double clicking on its cell a lot more show up (but really, on a projected CRS how many are used?), then when moving the focus the value change to one expressed in scientific notation Recording.6.mp4When canvas is in 4326, georef configured to 3763, the dest x/y values are in a projected crs(?), then if clicking in a cell of the gcp table values change to geographic, but only for dest x. Recording.7.mp4 |
I think this is out of scope for the fix, the table should still use the default Qt number formatting. What matters is if the numbers are good. Here is what I was expecting to test when I had the time:
|
maybe, but is totally confusing, |
raster file name for these and not the output raster file name The GCPs relate specifically to the ORIGINAL image, not the warped output exported after georeferencing. If we use the output file name for the .points file then when THIS georeferenced output is loaded into the georeferencer we get misleading location of source GCP points, as the pixel coordinates are from the ORIGINAL image, not the warped one.
from class which stores graphical item representing point
This is too fragile, there's too many different situations which should lead us to invalidate the cached point which are not being caught.
points instead of always using source pixel row/columns The "always use pixels" approach does not work well when a source image already has some georeferencing information attached. Also add tests for this, and fix loading of "enabled" status for points when loading points from a file
enabled And partially fix this functionality when using an already georeferenced image (not fully)
@nyalldawson Did my tests, everything seemed ok, even with a projected dataset. |
points don't move on canvas when edited in list
91a058f
to
ca2dbef
Compare
I'm curious to see how much rework will be needed in 46941 & #41386 🤣 Nyall I know you had interest in 41386, let me do the cleanup and you can take over after if you want, no use in having you do some work I could be doing (albeit slower) during the freeze. Other than reworking the dwg importer I didn't find any easy bugs I could fix quickly and willingly at the moment, so I wouldn't mind updating my things in my free-time. |
Merged for wider testing |
@nyalldawson confirmed! |
Before trying to fix the mess that has gotten into, we need a good test suite...!