-1

When I type "go get github.com/lukeroth/gdal" in windows machine, I am getting an error and it says

..go\src\github.com\lukeroth\gdal\algorithms.go:4:
./go_gdal.h:8:10: fatal error: gdal.h: No such file or directory
include <gdal.h>
^~~~~~~~
compilation terminated.

However, in cmd window, I can see that gdal is installed and when I type "gdalinfo --version", I can get a result that says "GDAL 2.4.1, released 2019/03/15".

I can also see that gdal.h and other necessary files are also under "C:\Program Files\QGIS 3.6\include" and after adding this path as GDAL_PATH variable, I am still getting the same error.

Seems like I am failing to add gdal on the path and I cannot import "github.com/lukeroth/gdal" into my code.

How can I solve this problem?

Since I was not able to get lukeroth's GDAL, I was trying to execute GDAL python script through Go. If I run "gdal_polygonize.py output.tif -f "ESRI Shapefile" mylayer.shp" command in Windows cmd, it works fine. But running it in code does not work. "exec.Command" works if I run a python scripts with no argument though.

cmd := exec.Command("gdal_polygonize.py", "output.tif", "-f","'ESRI Shapefile'","mylayer.shp") //doesnt works
err3 := cmd.Run()
fmt.Println("Finished:", err3)

I would appreciate any help on this issue as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.