I'm translating gdal2tiles to Go with Lukeroth/Gdal bidngings and a DatasetRasterIO call from Go bindings for GDAL spits out 2 color channel image (Red & Green). After one tile gets created, on the second pass of the function call, it throws an exception that full of hex addresses but not obvious answer.
EDIT: Its not creating any files now, it just keeps throwing this same exception as soon as it hits ds.IO(args...)
and if it manages to go past it, it happens again on dsQuery.IO(args...)
. I modified the tilebands(bandCount int) argument and reduced its bandCount and it managed to pass but not create an image. Anything above 1 band throws the exception.
EDIT: The error is
Exception 0xc0000005 0x1 0xc000400000 0x7ff912b9c343
PC=0x7ff912b9c343
runtime: unknown pc 0x7ff912b9c343
stack: frame={sp:0x121f6d0, fp:0x0} stack=[0x0,0x121fdf0)
000000000121f5d0: 000000000421df20 00007ff912b777f6
000000000121f5e0: 00000000040b1910 0000000000000000
000000000121f5f0: 0000000004e94000 0000000000000001
000000000121f600: 00000000040b1e90 00007ff9136a6650
000000000121f610: 0000000000000361 00007ff912b6ff06
000000000121f620: 00000000040b1910 00007ff912b1eaad
000000000121f630: 000000000421df20 0000000000000000
000000000121f640: 0000000000000001 0000000000030000
000000000121f650: 00000000040b1910 00007ff912b7092c
000000000121f660: 00000000040b1910 0000000000000000
000000000121f670: 0000000000000001 00000000040795f0
000000000121f680: 0000000000000040 0000000000000030
000000000121f690: 0000000000000000 0000000000000001
000000000121f6a0: 0000000000000000 0000000000000000
000000000121f6b0: 000000000000aa00 000000000002e000
000000000121f6c0: 00000000040b1910 00007ff912b9c302
000000000121f6d0: <00000000000000cf 000000000121f7d0
000000000121f6e0: 00000000040b21b0 000000000121f6f0
000000000121f6f0: 0000000000000004 0000000000000009
000000000121f700: 0000000050000100 00007ff9629d168e
000000000121f710: 0000000000000000 000000004904004d
000000000121f720: 0000000050000163 0000000006040002
000000000121f730: 0000000000040004 00000000040b1f90
000000000121f740: 0000000000000000 0000000100000080
000000000121f750: 000000b800000000 0000000000000000
000000000121f760: 0000000001410000 00007ff96292a0b8
000000000121f770: 0000000001414dd0 0000000000000001
000000000121f780: 00000000014102c8 0000000000000000
000000000121f790: 0000000001414dc0 0000000001414e10
000000000121f7a0: 0000000000000080 00007ff9628dfa22
000000000121f7b0: 0000000001410000 0000000001414dd0
000000000121f7c0: 000000000000009a 0000000000000000
runtime: unknown pc 0x7ff912b9c343
stack: frame={sp:0x121f6d0, fp:0x0} stack=[0x0,0x121fdf0)
000000000121f5d0: 000000000421df20 00007ff912b777f6
000000000121f5e0: 00000000040b1910 0000000000000000
000000000121f5f0: 0000000004e94000 0000000000000001
000000000121f600: 00000000040b1e90 00007ff9136a6650
000000000121f610: 0000000000000361 00007ff912b6ff06
000000000121f620: 00000000040b1910 00007ff912b1eaad
000000000121f630: 000000000421df20 0000000000000000
000000000121f640: 0000000000000001 0000000000030000
000000000121f650: 00000000040b1910 00007ff912b7092c
000000000121f660: 00000000040b1910 0000000000000000
000000000121f670: 0000000000000001 00000000040795f0
000000000121f680: 0000000000000040 0000000000000030
000000000121f690: 0000000000000000 0000000000000001
000000000121f6a0: 0000000000000000 0000000000000000
000000000121f6b0: 000000000000aa00 000000000002e000
000000000121f6c0: 00000000040b1910 00007ff912b9c302
000000000121f6d0: <00000000000000cf 000000000121f7d0
000000000121f6e0: 00000000040b21b0 000000000121f6f0
000000000121f6f0: 0000000000000004 0000000000000009
000000000121f700: 0000000050000100 00007ff9629d168e
000000000121f710: 0000000000000000 000000004904004d
000000000121f720: 0000000050000163 0000000006040002
000000000121f730: 0000000000040004 00000000040b1f90
000000000121f740: 0000000000000000 0000000100000080
000000000121f750: 000000b800000000 0000000000000000
000000000121f760: 0000000001410000 00007ff96292a0b8
000000000121f770: 0000000001414dd0 0000000000000001
000000000121f780: 00000000014102c8 0000000000000000
000000000121f790: 0000000001414dc0 0000000001414e10
000000000121f7a0: 0000000000000080 00007ff9628dfa22
000000000121f7b0: 0000000001410000 0000000001414dd0
000000000121f7c0: 000000000000009a 0000000000000000
goroutine 5 [syscall]:
MCH/vendor/github.com/lukeroth/gdal._Cfunc_GDALDatasetRasterIO(0x407e2e0, 0xcf00000000, 0x1dc00000000, 0x9a, 0xc00032c000, 0x14c00000400, 0x300000001, 0xc000320990, 0x0, 0x0, ...)
_cgo_gotypes.go:773 +0x5a
MCH/vendor/github.com/lukeroth/gdal.Dataset.IO.func1(0x407e2e0, 0xcf00000000, 0x1dc00000000, 0xc00000009a, 0xc00032c000, 0x14c00000400, 0x300000001, 0xc000320990, 0x0, 0x0, ...)
C:/Users/vhernandez/Go/src/MCH/vendor/github.com/lukeroth/gdal/gdal.go:836 +0x148
MCH/vendor/github.com/lukeroth/gdal.Dataset.IO(0x407e2e0, 0x0, 0xcf, 0x0, 0x1dc, 0x9a, 0x859260, 0xc000005060, 0x400, 0x14c, ...)
C:/Users/vhernandez/Go/src/MCH/vendor/github.com/lukeroth/gdal/gdal.go:836 +0x24c
MCH/web/mapping.create_base_tile(0xc000140000, 0x8de7, 0x12684, 0x11, 0xcf, 0x0, 0x1dc, 0x9a, 0x0, 0x2b4, ...)
C:/Users/vhernandez/Go/src/MCH/web/mapping/gdal2tiles.go:1222 +0xa00
MCH/web/mapping.TestGeoTiffToTiles(0xc000128100)
C:/Users/vhernandez/Go/src/MCH/web/mapping/gdal2tiles_test.go:70 +0x1e1
testing.tRunner(0xc000128100, 0x9289f0)
C:/Go/src/testing/testing.go:827 +0xd7
created by testing.(*T).Run
C:/Go/src/testing/testing.go:878 +0x35a
goroutine 1 [chan receive]:
testing.(*T).Run(0xc000128100, 0x90fcb1, 0x12, 0x9289f0, 0xbd1f00)
C:/Go/src/testing/testing.go:879 +0x381
testing.runTests.func1(0xc000128000)
C:/Go/src/testing/testing.go:1119 +0x7f
testing.tRunner(0xc000128000, 0xc00007bdf0)
C:/Go/src/testing/testing.go:827 +0xd7
testing.runTests(0xc000004ec0, 0x812c30, 0x1, 0x1, 0xc00007bee8)
C:/Go/src/testing/testing.go:1117 +0x2b1
testing.(*M).Run(0xc000124080, 0x0)
C:/Go/src/testing/testing.go:1034 +0x16c
main.main()
_testmain.go:42 +0xc8
rax 0xc0003d2000
rbx 0xcf
rcx 0x6c
rdi 0x40b1910
rsi 0x421df20
rbp 0x121f7d0
rsp 0x121f6d0
r8 0x40b21b0
r9 0x4079670
r10 0x1
r11 0xb8
r12 0x2e000
r13 0xaa00
r14 0x414dc00
r15 0x0
rip 0x7ff912b9c343
rflags 0x10206
cs 0x33
fs 0x53
gs 0x2b
I've searched online with no luck, documentation is lacking and I've also tried contacting multiple people with no reply.
EDIT: This is my Go Env. Windows 10.
set GOARCH=amd64
set GOBIN=C:\Users\***\go\bin
set GOCACHE=C:\Users\***\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\***\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-
map=C:\Users\***~1\AppData\Local\Temp\go-build231797866=/tmp/go-build -
gno-record-gcc-switches
EDIT: This is my problematic block of code.
if rxsize != 0 && rysize != 0 && wxsize != 0 && wysize != 0 {
for d := 1; d <= dataBandsCount+1; d++ {
idx := d - 1
band_list[idx] = d
}
err = alphaband.IO(gdal.Read, rx, ry, rxsize, rysize, alpha, wxsize, wysize, 0, 0)
checkError(err)
err := ds.IO(gdal.Read, rx, ry, rxsize, rysize, data, wxsize, wysize, tilebands, band_list, 0, 0, 0) //This is where the exception happens. All values are valid.
checkError(err)
}
if len(data) != 0 { // if data
if tilesize == querysize {
dstile.IO(gdal.Write, wx, wy, wxsize, wysize, data, wxsize, wysize, tilebands, band_list, 0, 0, 0)
dstile.IO(gdal.Write, wx, wy, wxsize, wysize, alpha, wxsize, wysize, tilebands, band_list, 0, 0, 0)
} else {
dsquery := mem_drv.Create("", querysize, querysize, tilebands, gdal.Byte, []string{options})
err := dsquery.IO(gdal.Write, wx, wy, wxsize, wysize, data, wxsize, wysize, tilebands, band_list, 0, 0, 0)
checkError(err)
err = dsquery.IO(gdal.Write, wx, wy, wxsize, wysize, alpha, wxsize, wysize, tilebands, band_list, 0, 0, 0)
checkError(err)
scale_query_to_tile(&dsquery, &dstile, tile_job_info.tile_driver, []string{options}, tilefilename)
dsquery.Close()
dsquery = gdal.Dataset{}
}
}
out_drv.CreateCopy(tilefilename, dstile, 0, []string{}, nil, nil)
data = nil
dstile.Close()
I'm expecting for IO calls to read and write to their respective drivers and finally dump them out. After the every iteration of tile_details, base tiles should be generated and the next call should be creating the overview tiles (pyramid).
User contributions licensed under CC BY-SA 3.0