// Open a shared existing dataset func OpenShared(filename string, access Access) Dataset { cFilename := C.CString(filename) defer C.free(unsafe.Pointer(cFilename)) dataset := C.GDALOpenShared(cFilename, C.GDALAccess(access)) return Dataset{dataset} }
// Open an existing dataset func Open(filename string, access Access) (Dataset, error) { cFilename := C.CString(filename) defer C.free(unsafe.Pointer(cFilename)) dataset := C.GDALOpen(cFilename, C.GDALAccess(access)) if dataset == nil { return Dataset{nil}, fmt.Errorf("Error: dataset '%s' open error", filename) } return Dataset{dataset}, nil }