admin管理员组文章数量:1391943
I used this script to crop a raster using a polygon shapefile with python gdal.Warp, but it seems it leaves many pixels with value = 1 outside the cropline
gdal.Warp(rasterOut.jp2,
rasterIn.jp2,
cutlineDSName=mask.shp,
cropToCutline=True,
dstNodata = nodata)
I can select any nodata, like 0 or np.nan, but the results doesn't change
I used this script to crop a raster using a polygon shapefile with python gdal.Warp, but it seems it leaves many pixels with value = 1 outside the cropline
gdal.Warp(rasterOut.jp2,
rasterIn.jp2,
cutlineDSName=mask.shp,
cropToCutline=True,
dstNodata = nodata)
I can select any nodata, like 0 or np.nan, but the results doesn't change
Share Improve this question asked Mar 13 at 10:37 ilFontailFonta 3014 silver badges20 bronze badges1 Answer
Reset to default 0Can you try setting stricter clipping with warpOptions=["CUTLINE_ALL_TOUCHED=TRUE"])
gdal.Warp("rasterOut.jp2", "rasterIn.jp2",
cutlineDSName="mask.shp",
cropToCutline=True,
dstNodata=nodata,
warpOptions=["CUTLINE_ALL_TOUCHED=TRUE"])
本文标签: python gdalwarp doesn39t properly crop raster over shapefile polygonsStack Overflow
版权声明:本文标题:python gdal.warp doesn't properly crop raster over shapefile polygons - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744707286a2620916.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论