[gdal-dev] How to obtain the raster footprint poly of actual data with python
gdisk.mike
gdisk.mike at gmail.com
Mon Oct 3 10:20:05 PDT 2022
To get the result using command line, I found the 3 commands did the trick.
gdal_translate -b mask -of vrt -a_nodata 0 'path/to/input.tif' test.vrt
gdal_translate -b 1 -of vrt -a_nodata 0 test.vrt test2.vrt
gdal_polygonize.[bat/py] -q -8 test2.vrt -b 1 -f "ESRI Shapefile"
testdata.shp
This was off Stack exchange somewhere.
However, I'd like to get this same geometry in python.
I keep hitting roadblocks as I'm not real sure how to use
gdal.Translate or gdal.TranslateOptions
ive tried
gtp = gdal.TranslateOptions(format="vrt",bandList="mask", noData=0)
in attempt to start with the first gdal_translate command.
I'm also curious if there's another way, perhaps using --oo or something
different.
In the end I'd ultimately like to get a geometry poly object of where the
actual imagery data is in the file.
Any pointers?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221003/2147d699/attachment.htm>
More information about the gdal-dev
mailing list