mosaic and use cutline to display only in specific area #625
-
I try to mosaic two of cog tif files and then i want to apply cutline to it but it does not work |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
@satas12825 please provide more context or code 🙏 |
Beta Was this translation helpful? Give feedback.
-
Yes the way the cutline is configured, all pixels that are touched by the cutline (i.e. the pixel boundary polygon). So pixels will tend to slightly "overflow" the cutline geometry lines. The reason for this is explained in the comment @vincentsarago shared. We want this cutline to give identical results, even if there are multiple resolution in ImageData. This is only guaranteed for One way to work around this for now would be to use a negative buffer of about 1 pixel size on your geometry before using it as cutline. This will make the rasterization more constraint. Another one would be to increase the resolution of your target raster, then the cutline is going to be following a finer grid, so that could help too. |
Beta Was this translation helpful? Give feedback.
-
@yellowcap @vincentsarago |
Beta Was this translation helpful? Give feedback.
Yes the way the cutline is configured, all pixels that are touched by the cutline (i.e. the pixel boundary polygon). So pixels will tend to slightly "overflow" the cutline geometry lines. The reason for this is explained in the comment @vincentsarago shared. We want this cutline to give identical results, even if there are multiple resolution in ImageData. This is only guaranteed for
all_touched=True
mode, otherwise smaller pixels will be dropped and the masks will end up being different.One way to work around this for now would be to use a negative buffer of about 1 pixel size on your geometry before using it as cutline. This…