I am trying to get raster to shape form in R using John Baumgartner's code. This function needs gdal_polygonize.py from gdal package. I installed gdal package using: (I am using MacOS Sierra Version 10.12.6)
brew install gdal --HEAD
When I check for the version. It seems I have installed GDAL:
gdalinfo --version
GDAL 2.3.0dev, released 2017/99/99
Now when I try to run the gdal_polygoniseR function. It gives error. It needs gdal_polygonize.py file. I am stuck at this point:
> system.time(p <- gdal_polygonizeR(r1))
Error in gdal_polygonizeR(r1) :
Can't find gdal_polygonize.py on your system.
I wanted to check if it exists or not and if it does then its path:
> Sys.which("gdal_polygonize.py")
gdal_polygonize.py
""
I saw that there is one additional step after installing GDAL:
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile
source ~/.bash_profile
I am able to run this line but does not help as the framework folder does not have gdal folder. When I check for this I do not see "GDAL.framework" in my "Library/Frameworks/..".
If I am able to locate the ".py" file. I will be able to run the function. Any help on this would be grateful. Thanks in advance.