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?
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to