Closed VRichardJP closed 2 years ago
This is related to a GDAL limitation - its RasterIO
function, which we use for loading data, doesn't support loading sections which contain pixels for which no data is available. I'm currently working on a workaround for this, so that Geodot returns an image with black pixels for such sections.
With that, it should be easy to just load a square which encompasses all data, and then only use the part in which data is available. Directly fetching non-square segments as GeoImages is not something we're planning to support, but this workaround should solve most problems which arise from this limitation, so I'll keep this open until that's done.
However, it should generally be no problem to load a square window from a non-square dataset, as long as this square window is fully covered with available data. It says that you're requesting '(0,-594) of size 647x647 on raster of 1242x648.'. I'm assuming the y coordinate of the origin point (-594) is the problem here - are you sure the projected coordinates you put into the get_image
call correspond to the top-left corner of the image?
In the error case I just tried to set the tile size to 1242, which I guess expects a 1242x1242 image :^) https://github.com/boku-ilen/geodot-plugin/blob/f16b7c7c437a0410e0580297bccb2c0551ba8b3d/demo/RasterDemo.gd#L6
Actually this size is independent of the source resolution, the data is scaled up or down depending on the resolution of the data vs. the requested resolution. You could theoretically request a 10000x10000 image from your data, it'll just be very blurry.
The meter size of the window (in the line above the one you posted) is important here, as that needs to be within the available data until the workaround I'm building is done. But according to the error message you got, your meter size was fine, just the top-left y-coordinate was outside of the available data. Maybe try adding 594 to your start_position_y
?
Sorry these parameters are working:
export(float) var start_position_x = 15208294.336400000378489
export(float) var start_position_y = 4159389.058000000193715
export(float) var tile_size_meters = 648
export(int) var tile_size_pixels = 648
I have set these parameters based on Size
, Origin
and Pixel Size
(1px = 1m) output from gdalinfo
(see first comment)
The non working case is with the following parameters:
export(float) var tile_size_meters = 1242
export(int) var tile_size_pixels = 1242
In such case, moving start_position by (0, 594) fix the demo:
export(float) var start_position_x = 15208294.336400000378489
export(float) var start_position_y = 4159389.058000000193715 + 594
export(float) var tile_size_meters = 1242
export(int) var tile_size_pixels = 1242
The problem described in my first comment (the inability to load sections not fully covered by data) has been fixed in the last few commits: it's now possible to load any section, even if there is no data at all, and the parts without coverage will simply be 0.
In addition, https://github.com/boku-ilen/geodot-plugin/commit/817a65b2e46cb3769e53b28ccb626597afde43f0 added the function get_center()
to the GeoRasterLayer
- this makes it easier to place oneself within the data without having to use external tools like gdalinfo
.
I could successfully run the demo. I also had some success with a custom geotiff file. However the area I want to render is not a square (1242x648) and if I modify the demo code to try to display the full image I get an error like this:
Is there any support for non-square image?
info about the geotiff: