Timeline for Generate an empty large raster using GDAL?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 24, 2020 at 16:21 | comment | added | Jon | @TheoF The documentations are correct. The "origin" for most image processing applications is the top-left rather than bottom-left. Johan is correct that this is accounted for by having a negative y resolution, which does seem odd. | |
Jan 24, 2020 at 16:20 | comment | added | Johan | In general, If you imaging a plot, the top left corner coordinate of the plot will be (xmin, ymax). So, if you want the image to go down (normally southward), you should "add" negative pixels, i.e. subtract y resolution. To check myself, I looked up some geotransforms of some tiffs that I could get my hands on: they all have a negative y-resolution. So i think that the documentation that you saw has it right. | |
Jan 24, 2020 at 15:56 | comment | added | Theo F | yes I've seen quite a few documentations that say use the top left corner... when it should say bottom left. weird! | |
Jan 24, 2020 at 15:21 | comment | added | Johan |
Thanks for the sharp eye. From the documentation on the gdal raster data model: The (GT(0),GT(3)) position is the top left corner of the top left pixel of the raster. So, the ymax should be given as I put in my example. What should be done to flip the image to what you want, the yres should be negative. I updated the example so that it works now.
|
|
Jan 24, 2020 at 15:08 | history | edited | Johan | CC BY-SA 4.0 |
improve
|
Jan 24, 2020 at 14:51 | vote | accept | Theo F | ||
Jan 24, 2020 at 14:49 | comment | added | Theo F |
on ds.SetGeoTransform replace ymax with ymin to prevent the raster being vertically flipped into the map region above your intended area.
|
|
Jan 24, 2020 at 14:11 | comment | added | Theo F | thanks however that appears flipped. ie. it appears above my area of interest. | |
Jan 24, 2020 at 13:05 | history | answered | Johan | CC BY-SA 4.0 |