0

I have two rasters that I clipped using the same shapefile. I then used gdal to resample them into the same resolution but now I have an issue where the shapes are very similar but not quite the same. How do you suggest fixing this? I've been stuck on this for the last couple of hours so help would be greatly appreciated.

Here's the output I get:

print(dsm.shape,ortho.shape)

(1, 13110, 14640) (4, 13111, 14641)

As you can see one of the rasters only has one band, whereas the other one has 4. I tried doing this:

dsm = np.resize(dsm,(dsm.shape[0],ortho.shape[1],ortho.shape[2]))

But this just distorted the raster. I've also tried building a VRT but was running into issues since one of the rasters has multiple bands. I think that'll be my next method of attack, but I figured I'd drop by here first in case someone could offer some help.

Thanks!

Phanster
  • 65
  • 6
  • How did you used gdal to resampled them into the same resolution? If the registrations of them are different at this point, you will have to distort it further in order to combine them. – binzo Jul 07 '21 at 19:10

1 Answers1

0

The easiest way to solve this problem was to just find the maximum height and width of the raster arrays and pad both rasters to make sure they have these dimensions.

Largest deviation I saw was a difference of 2 pixels, and visually I can tell no difference when comparing these images after padding the arrays.

Phanster
  • 65
  • 6