-
-
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 gdal command #46415
Fix gdal command #46415
Conversation
@roya0045 I think the minus sign is needed. |
So this would only be an issue for raster that are already georeferenced? That's possible. |
Yes. If the added raster has a geotransform set, then the "Source X" and "Source Y" are incorrectly not expressed as raster pixels coordinates, but as geotransformed coordinates.
|
Though the issue is not the gdal expression exported but the process itself. Maybe @rouault would be able to tell if gdal only works with pixel coordinates or projected coords once an image is georeferenced. |
it depends on utilities and options used. It is normally clearly documented. e.g if using gdal_translate, -srcwin is in pixel coordinates and -projwin in georeferenced coordinates |
@rouault, AFAIK this is not the case for gdal_translate -gcp option, in which <pixel> and <line> values are always in raster pixels coordinates even if the source raster already has a geotransform set, isn't it? |
@agiudiceandrea yeah it works fine with non-georeferenced images, in the georeferencer the top-left corner is 0,0 and the image has negative y, so making them positive makes the command work. Though I have reservations about removing an transformation on the image. If someone would want to adjust something they would have to import the geoerefenced image in the canvas to get the coordinates of the existing pixel. This would be an instance where the user would want to correct the deformation or perform a simple transform on an image that is already georeferenced and 'deformed'. If they have the original points that would be doable. |
yes |
@agiudiceandrea I thinnk the best solution would be to add a coord to the datapoint, currently the 'pixelcoord' is the position in the georeferencer, it's not the true coordinate of the chosen pixel, it's the rastercoord. I can check into reworking the code and making sure the raster coord gets properly converted into the true pixel coords. That way there is no need for finicking around with a 'hack' (the - in the gdal script) and would be more consistent. @nyalldawson does that sounds like a reasonable approach? |
Needed code seem to be mostly present, though convoluted. Will investigate the issue. |
Description
Minor bug/typo? encountered while digging into #46414
@nyalldawson Would you know if this is a typo, I assume it is.
Though strangely with this error, it yielded the same results as our standard process, now the outputs are different, maybe there is another extra negative somewhere or I'm just dealing with weird cases? Still not sure why already georeferenced images are handling badly regardless of the method.